Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

Previous Page's URL

Environment: Visual Studio 2019, ASP.NET and C#
Hello,
Requirement: I have a page, which can be called from couple of web pages.  I need to return to the (Response.Redirect) page from where it was called by clicking a Back button.  

Possible soultion:  So I am retriving the called page URL by using CalledPageURL = Page.Request.UrlReferrer.ToString().  The value I retrivie is http://localhost:62000/Home.aspx. Now I need to save this value, so that it would not get refreshed (null) during page Post Back (IsPostBack).

I am trying to use Session variable or ViewState options.  But both of them are not working. They save the value successfully.  But I try to retrive the vallue, I am getting null exception. Please let me know how to fix it.

Thank you in advance.
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

You can add a model property called callerUrl and store it as a hidden input in your view.
If more help needed please post your controller code and your associated view. I do not need all you code just the basics like how you call your page and Index and Post methods

ASKER CERTIFIED SOLUTION
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial