0

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.

Firoz Jafri
  • 168
  • 1
  • 8

3 Answers3

1

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.

Carles Company
  • 7,118
  • 5
  • 49
  • 75
1

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

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

Community
  • 1
  • 1
Rahul
  • 2,309
  • 6
  • 33
  • 60
0

save all document.referrer in a data structure and when the user click the back button pass the data to server and redirect him to data[last-1] page.

giannisf
  • 2,479
  • 1
  • 17
  • 29