在MVC4中隐藏Url参数

时间:2014-06-30 18:33:43

标签: asp.net-mvc-4

我想在MVC 4 Web APPlication中隐藏或加密我的Url参数

我的行为准则

 public ActionResult Login(AllotteeModel model, string returnUrl)
        {


            var clogic = new CUserLogic();
            var cprop = new CUserProp();
            cprop.ConsumerId = model.Consumerid;
            cprop.Password = model.Password;
             var login = clogic.ValidateLogin(cprop);
            if (login=="0")
            {
                var data1 = clogic.Getallproperty(model.Consumerid);
                var data2 = data1.Single(e => e.ConsumerId == model.Consumerid);
                string username = null;
                if (data2.ConsumerId!=null)
                {
                    username = data2.ConsumerName;
                }

                Session["Key"] = model.Consumerid;
                Session["UserName"] = username;
                model.CustomerName = data2.ConsumerName;
                model.ConnectionNo = data2.ConnectionNo;
                model.Sibling = data2.Sibblings;
                model.ConnectionDate = data2.ConnectionDate;
                model.PhoneNo = data2.PhoneNo;
                model.PendingAmount = data2.Balance;
                model.EmailId = data2.EmailId;
                return RedirectToAction("Home", "Home",model);
            }
            else
            {
                ModelState.AddModelError("", "The user name or password provided is incorrect");
                return RedirectToAction("Login");
            }
登录后

和URl

localhost:3192/Home/Home?Consumerid=TEST&Password=TEST&ZoneList=System.Collections.Generic.List`1[System.Web.Mvc.SelectListItem]&CustomerName=ansf&ConnectionDate=06%2F14%2F1999 12%3A00%3A00 AM

0 个答案:

没有答案