开发者

Return from redirect

How can i redirect user in filter to another action and remember action which he wanted to do before redirect and repeat it after he do any action on that redirec开发者_开发百科ted page?


In the filter:

public override void OnActionExecuting(ActionExecutingContext filterContext)
{
    var dictionary = new RouteValueDictionary();
    dictionary["action"] = "newaction";
    dictionary["controller"] = "home";
    dictionary["returnUrl"] = filterContext.RequestContext.HttpContext.Request.Url.AbsoluteUri;
    filterContext.Result = new RedirectToRouteResult(dictionary);
}

And then use the returnUrl parameter in the new action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜