views:

18

answers:

3

I have three pages calculator1.aspx, calculator2.aspx and Menu.aspx. On each calculator page i have a button that redirect me to Menu page and on Menu page i have to go back to Calculator1 or calculator2 page from where the request initiated. So how can i differentiate from which page my request come when im on Menu page.

+1  A: 

You best bet it to check the HTTP_REFERER header. It can be spoofed, but more often than not it will be enough.

string referer = Request.ServerVariables["HTTP_REFERER"];
Oded
+1  A: 

You can make use of URL rewriting.
on click of button on calulator1.aspx write

Response.Redirect('menu.aspx?page=cal1')

on click of button on calulator2.aspx write

Response.Redirect('menu.aspx?page=cal2')
Himadri
+1  A: 

You can use Page.PreviousPage property, to get the page that transferred control to the current page.
Or using HttpRequest.UrlReferrer property, to get information about the URL of the client's previous request that linked to the current URL.

[Links]
Page.PreviousPage
HttpRequest.UrlReferrer

Ahmed