I have a main page which has a few filters that I want to keep when I return to this main url. But after loading another pages I want to go back. It could be easily done by getting the @Request.UrlReferrer
. However, it only works when returning to the previous page, I need it for the previous 2 pages.
I could do it by using Session["ReturnToMainUrl"] = Request.UrlReferrer
but setting it only when getting off the first page.
So If I have 3 levels:
- WebSite\page1?Filter=ABC
- WebSite\page2
Website\page3
I am on page2 or page3 now and I want to go back to Website\page1?Filter=ABC
When I am on the page 3 I can use Request.UrlReferrer
to go back to page 2, but when I go back to page 1 I need to keep the parameters so I am loading from the Session.
How can I do it in a smarter way, not using sessions?