session| page in the development process in order to meet customer requirements to achieve such a function: In a page click a text link into the C page, after clicking the return button can return a page, and in the B page also has the text connection, click on the C page, Returns the B page (there is only one return button in the C page). This thought of the use of the session function, that is, to the C page when the record is jumping from which page, and then click the Return button to the contents of the session to judge, so that the decision is to return a page or b page.
First in the A,b two pages to add the code to get the page path
String url=request.currentexecutionfilepath.tostring ();
Get the virtual path of the current page
session["URL"]=URL;
Response.Redirect ("C.aspx", true);
In the C page first through session to get the last page of the virtual path
String url=session["url"]. ToString ();
Since the first half of the virtual path of the A.B two pages is the same, in fact we just have to judge whether it is "a.aspx" or "b.aspx". So we get the name of the page we want by using the Split method, and then we can assign the name to a label, Hide the label inside the page (whether you need to use lable to save the page name in this case depends on the situation).
String[] Split=url. Split (new char[] {'/'});
int N=split. Length;
String pathname=split[n-1];
Label1.text=pathname;
Finally, in the response to the return button to determine the event, decide which page to return:
if (label1.text== "a.aspx")
Response.Redirect ("A.aspx", true);
Else
Response.Redirect ("B.aspx", true);