ASP.NET MVC 2 Returning to previous screen
Is there a way to return to the previous view without having to record all the parameters that were used to get to the view in question. Consider this situation. You have a search screen with input parameters, you press search and get results displayed on the page. You click 开发者_开发技巧on one item to get a detailed look which redirects you to a new view. Does MVC have the ability to get the previous query string that contains the search parameters?
Not that I know of. You could save it in the session, but how about using JS history.back()
Wouldn't the user just use the back button on the browser? Are you wanting to present a "Back to results" link on the detail page? Also look at Request.UrlReferrer if you don't want to save the search parameters in session or a cookie.
You can use Request.UrlReferrer
精彩评论