MVC 5 Routing Attribute

后端 未结 4 1275
梦如初夏
梦如初夏 2020-12-19 00:37

I have the Home Controller and my Action name is Index. In My route config the routes like below.

routes.MapRoute(
    \"Default\",   // Route name
    \"{c         


        
4条回答
  •  -上瘾入骨i
    2020-12-19 01:11

    public class URLRedirectAttribute : ActionFilterAttribute
        {
            public override void OnActionExecuted(ActionExecutedContext filterContext)
            {
                    string destinationUrl = "/VoicemailSettings/VoicemailSettings";
                    filterContext.Result = new JavaScriptResult()
                    {
                        Script = "window.location = '" + destinationUrl + "';"
                    };
            }
        }
    

提交回复
热议问题