Solution 1: javascript scheme: (if this scheme is used on the server control, the jump cannot be implemented, because the server control will send back once before the jump, and the value of document. referrer is changed)
Add a js method to the image buttonGopre ()
JSCode:
<SCRIPT type = "text/JavaScript">
Function gopre (){
Window. Location. href = Document. referrer; // use document. referrer
}
</SCRIPT>
Solution 2: Asp.net background processing solution: (I am using the imagebutton Control)
<Asp: imagebutton id = "imgbtncancel" runat = "server" imageurl = "images/login_07.gif"
Onclick = "imgbtncancel_click"/>
Step 1: Obtain request. urlreferrer in the page_load method and save it in viewstate.
If (request. urlreferrer! = NULL)
{
Viewstate ["urlpre"] = request. urlreferrer;
}
Step 2: Set button click eventsOnclick
Protected void imgbtncancel_click (Object sender, imageclickeventargs E)
{
Response. Redirect (viewstate ["urlpre"]. tostring ());
}
conclusion: the above two methods can be used to redirect back to the previous page. To reduce the pressure on the server, client redirection is generally preferred, that is, the JS solution.