开发者

ASP.NET MVC 2 Returning to previous screen

开发者 https://www.devze.com 2023-01-23 01:18 出处:网络
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 pa

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

0

精彩评论

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