How to go back to previous page and preserve the previous page data in c#
<p>I am working on a Retail Website which is developed in Asp.net 3.0. I have a cart system so when user add some items to their cart they are being redirect to Basket page. And  i have a button on Basket page for them to go back add some more items. i am not sure how to do that.</p>

<p>here is the case.</p>

<pre><code>Home Page -&gt; Mens Clothing Product List -&gt; Jeans Page -&gt; Basket pgae
</code></pre>

<p>Now when users go to  Mens Clothing they see all the items, then they select one Jeans they want to buy and they are redirected to Jeans Page. Now they add items to their basket and they are redirected to Basket Page, Now i have a button on Basket page called "Keep Shopping", When they click (as of now they are redirected to Home page) BUT i need them to redirect to Mens Clothing Product List instead of Home Page.</p>

<pre><code>CASE 1
</code></pre>

<p>I have googled it and found out that we can use URLReferrer and check it if it is null or not. BUT in my case it is always Basket Page URL as i am using Response.Redirect on Jeans Page. So i can not use URLReferrer.</p>

<pre><code>CASE 2
</code></pre>

<p>I have also found out that using Javascript History we can go back to 1 or 2 page. BUT as i want to preserve the user data and CART i can not use that as well because its gonna use the browser cache and will not save any users data.</p>

<pre><code>CASE 3
</code></pre>

<p>I was thinking of using the Context Or Session to store the current page URL on Jeans page and i can check it in Basket Page, if it not null then redirect to that page. BUT i want to go back one more step ie. Mens Clothing page not Jeans Page.</p>

<p>I am really not sure whether this will be a good idea or not. Please suggest.</p>

<p>Thanks...</p>
