Question about capturing previous page

H

Hardy Wang

Hi,
I have a legacy ASP page, in which I have following pieces of JavaScript
to run in order to sending values to a new ASPX page
......
action = "NewVersion/Bridge.aspx";
method='get';
submit();
......

In the new Bridge.aspx, I need to detect which privous page sends out the
request, so I have following codes in my ASPX code behind
Uri refUrl = Request.UrlReferrer;
Trace.Write(refUrl.AbsolutePath);

But system will throw an exception "NullReferenceException: Object reference
not set to an instance of an object." on second line. It looks like ASPX is
unable to detect its previous page if previous one uses form to sends
request.

Any clue how to obtain previous page?

Thanks!
 
J

John Saunders

Hardy Wang said:
Hi,
I have a legacy ASP page, in which I have following pieces of JavaScript
to run in order to sending values to a new ASPX page
.....
action = "NewVersion/Bridge.aspx";
method='get';
submit();
.....

In the new Bridge.aspx, I need to detect which privous page sends out the
request, so I have following codes in my ASPX code behind
Uri refUrl = Request.UrlReferrer;
Trace.Write(refUrl.AbsolutePath);

But system will throw an exception "NullReferenceException: Object reference
not set to an instance of an object." on second line. It looks like ASPX is
unable to detect its previous page if previous one uses form to sends
request.

Any clue how to obtain previous page?

UrlReferrer will be null if there is no Referrer header in the request.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top