I need to maintain the querystring in all pages in my asp.net mvc(C#) application.
For ex.:
I will call a page www.example.com?Preview=True. The querystring should be maintained whatever the page i click in www.example.com. i.e. When i click About us page in www.example.com, the url should be www.example.com/AboutUs?Preview=True
How can i achieve this? Whats the best place to do this common operation.?
An excellent direction from @eu-ge-ne.
I have used the idea of custom route from @eu-ge-ne to add the route value to every url and used a basecontroller to handle the Preview key in session.
I have used the above code in the
Initializemethod of the base controller. This way the preview key will in session if the querystring has Preview, else it removes from the session.Thanks to @eu-ge-ne once again.