How to get the previous to previous page name in asp.net
how to get second previous page name in asp.net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Amit KumarRank #459 · 5.4K reputationPosted Mar 14, 2016, 10:01 PM EDT
Amit Kumar SinghRank #562 · 4.3K reputationPosted Mar 14, 2016, 10:05 PM EDT
1.You have to store somewhere URL of page you want to recall, for example using ViewState in Page_Load() method:
2.Retrieve url from ViewState:
3.Get name of page with this url:
Amit Kumar SinghRank #562 · 4.3K reputationPosted Mar 14, 2016, 10:06 PM EDT
protectedvoidPage_Load(objectsender, EventArgs e){if(Request.UrlReferrer !=null){stringpreviousPageUrl = Request.UrlReferrer.AbsoluteUri;stringpreviousPageName = System.IO.Path.GetFileName(Request.UrlReferrer.AbsolutePath);}}