session - ASP.NET MVC how to implement link which returns to previous page? -
The title said all this.
Some references:
me represents a search mechanism - visual search, the search results view and got a description of the scene (one of the results, such as the webform See a form). I want a link in the details view, which will return the user to look at the search results.
think :
just read about Temptata, but I think it will not help, because the user wants to go back to some action.
The session can work, but I'm not sure how to fix it.
I do not want to use javascript to complete it. Edit
to:
think I'll stick with the EU-G-Ne'senshn is. Here's the result:
using the #region system. Web.Mvc; Using CompanyName.UI.UIApp.Infrastructure.Enums; # Ndrian namespace company name. UIUIPP. Infrastructure. Filter {/// & lt; Summary & gt; To apply the URL of the request in the /// session, apply the action method to the /// & lt; / Summary & gt; Public class RememberUrlAttribute: ActionFilterAttribute {public override void OnActionExecuting (ActionExecutingContext filterContext) {var HttpContext = filterContext.HttpContext; If (httpContext.Request.RequestType == "GET" & amp; & amp ;! httpContext.Request.IsAjaxRequest ()) {SessionManager .save (SessionKey.PreviousUrl, SessionManager.Get (SessionKey.CurrentUrl) ?? httpContext.Request. Url); Session manager Save (session's .content URL, HTPTX .URL.URL); }}}}
Biteedblu, is how does .IsAjaxRequest () method work? Does it only understand MS Ajax or better?
I think you did not want anything like this custom filter - did not test any time .s. Is:
public category PrevUrlAttribute: ActionFilterAttribute {public override zero OnActionExecuting (ActionExecutingContext filterContext) {var HttpContext = filterContext.HttpContext; Var session = filterContext.HttpContext.Session; If (httpContext.Request.RequestType == "GET" & amp; amp; httpContext.Request.IsAjaxRequest ()) {session ["PrevUrl"] = session ["CurUrl"] ?? HttpContext.Request.Url; Session ["qurl"] = httpContext.Request.Url; }}}
Comments
Post a Comment