how to be redirected to the previous page using response.redirect() in asp.net c#

前端 未结 1 1202
春和景丽
春和景丽 2020-12-31 08:34

Right now i have a folder with another folder inside of it. The two folder names are called \"pc details\" and \"pchardwaredetails\"

When on a page in \"pchardwarede

相关标签:
1条回答
  • 2020-12-31 08:55

    Usually the Referrer of the page (a HTTP header), tells you what page you've come from so to go back you should just be able to do:

    Response.Redirect(Request.UrlReferrer.ToString());
    

    That's assuming you came from PC Details. However if you land on PC Hardware Details from some other page then that won't work, you would have to hard code the back feature.

    You can simplify ASP.NET paths and use ~, for example:

    Response.Redirect("~/some/path/pc_details.aspx");
    
    0 讨论(0)
提交回复
热议问题