I am accessing Test.aspx through two different pages. Something like this:
Page1.aspx ——-> Test.aspx <——– Page2.aspx
I am testing this in IE7 where Request.UrlReferrer.AbsoluteUri is not working. In IE 8+ it works. Nothing I tried is working so far and its driving me nuts.
I also tried putting a hidden textbox in Page1.aspx so that I can see if the control textbox is available, if it is then I know I am coming from Page1 or else Page2. This code is not working:
var hidden = Page.PreviousPage.FindControl("tbhidden");
‘tbhidden’ is this: <asp:textbox ID="tbhidden" runat="server" visible = "false"/>
How would you crack this problem?
Normally the UrlReferrer will be blank for the first page bought up when a browser is started?
You can only use the Page.PreviousPage object if you are doing a server side redirect using the Server.Transfer command
Breaking the problem down
If you are using anchors to get to the test page then add a parameter to it in page1 and 2
and pick it up in the test page using
Request.QueryString[“from”]
If you are using a post then amend the form action in page1 and 2
This will double check that you are coming from the correct page.
Another good tip is to download the tool called “Fiddler”, it intercepts the website posts and gives a nicely formatted breakdown of all the referral values and page requests that occur.