asp.net mvc 重定向
生活随笔
收集整理的這篇文章主要介紹了
asp.net mvc 重定向
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
protected override void OnActionExecuting(ActionExecutingContext filterContext){if (Request.Cookies["manage"] == null){
//重置路由吧算是filterContext.Result = RedirectToRoute("default", new { Controller = "Land", Action = "Index" });}base.OnActionExecuting(filterContext);}
//重置路由吧算是filterContext.Result = RedirectToRoute("default", new { Controller = "Land", Action = "Index" });}base.OnActionExecuting(filterContext);}
?
在網(wǎng)上看到其他的解決方案:
filterContext.HttpContext.Response.Redirect("") //只需要加上 filterContext.Result = new HttpUnauthorizedResult() //或者 filterContext.Result = new EmptyResult() //filter驗證不通過就不會執(zhí)行action了,?
轉載于:https://www.cnblogs.com/mrma/p/3335205.html
總結
以上是生活随笔為你收集整理的asp.net mvc 重定向的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 胡迪克斯瓦尔机场可以还车吗?
- 下一篇: 蟑螂会飞吗!?