简体   繁体   中英

Maintain page flow in asp.net MVC

I want to get the same page when I hit back button it is similar to history.go(-1); in javascript.

But I don't want to use this as this thing does not work when you submit the form on Add or Edit, it shows you the same page.

Please help.

I think the easiest would be to implement a page stack (maybe store actionresults and save redirecttoactionsresults) in session and push and pop from it as needed. Then when going back via your link, you pop the last page pushed and redirect to it. If some page you want to skip simply don't push it to the stack.

Use System.Web.HttpContext.Current.Request.UrlReferrer to get the previous url.

Please refer C# ASP.NET MVC Return to Previous Page

将所有document.referrer保存在数据结构中,当用户单击“后退”按钮时,将数据传递到服务器,然后将其重定向到data [last-1]页面。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM