I have a button (Back) in destination Page like this :
localhost:22211/Departments/Departments.aspx
The Back on Click should take me back to the previous page with
localhost:22211/School/School.aspx?SId=122
How can I use
Response.Redirect(" //? ");
One way you could do this is:
Response.Redirect(Request.UrlReferrer);
EDIT: I don't have VS open right now. Could be Request.UrlReferrer.ToString()
How you are navigating to that destination page? ie Redirect or a postback linkbutton? You can set the PostbackUrl of the back button like:
if (!IsPostBack)
{
if (PreviousPage != null)
{
btnBack.PostBackUrl = PreviousPage.AppRelativeVirtualPath;
}
}
//Note: PreviousPage won't have value if you are doing redirect from your School page.
OR else you will have to store that url into Session and get that on destination page and set the Back url.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.