删除mvc4中url中的参数 [英] Remove parameters in url in mvc4

查看:80
本文介绍了删除mvc4中url中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HomeController发布方法



HomeController post method

[HttpPost]
       public ActionResult Login(Person P, int? id)
       {
           try
           {
               //var login = dbclass.LoginData(person, id);

               person = new Person();
               person = dbclass.LoginData(P, id);
               if (person != null)
               {
                   Session["FullName"] = person.Email;
                   Session["Role"] = person.RoleId;

                   return RedirectToAction("UserPage", person);

               }
               else
               {
                   ViewBag.Error = "Please Enter Valid Email Or Password";
                   return View();
               }
           }
           catch (Exception ex)
           {

               throw ex;
           }





其他操作员行动





Other Controller action

[HttpGet]
        public ActionResult UserPage(Person P)
        {
            return View(P);

        }





我的尝试:



每当一个控制器动作调用并重定向到其他控制器动作而不是通过一个控制器动作传递参数都在url中,那么如何在url中删除此用户名或passowrd参数以及其他传递方法参数。



What I have tried:

whenever one controller action call and redirect to other controller action than passing parameter by one controller action are in url,so how to remove this username or passowrd paramter in url as well as other tricks to passing parameter.

推荐答案

ASP.NET MVC在操作方法中删除查询字符串 - Stack Overflow [ ^ ]


这篇关于删除mvc4中url中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆