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.
精彩评论