Solved

ASP.NET and JavaScript Redirection

Posted on 2003-11-19
2
1,137 Views
Last Modified: 2007-12-19
I have a page which executes some JavaScript, redirecting the user to another page:

   // Redirection from oldpage.js
   window.location.href = sTargetPageURL;

But in targetpage.aspx's Page_Load() event, I can't access the Request.UrlReferrer property...it's Nothing...and I need to know who called this page!

   '// targetpage.aspx's Page_Load() event...
   Try
      sCallerPageURL = Me.Request.UrlReferrer.AbsoluteUri
   Catch   '<< EXCEPTION THROWN!  UrlReferrer is Nothing!
      sCallerPageURL = ""
   End Try

How can I redirect using JavaScript, so that I can still access my "calling" page via the UrlReferrer.AbsoluteUri property?

Thanks!
0
Comment
Question by:bryker
2 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 125 total points
ID: 9785231
The problem is that when you redirect your page the Request collection is undefined because you have not requested anything.

You can catch your referrer from javascript and the other way is to use Querystring

window.location.href = sTargetPageURL + "?previousPage=" + document.url;
so in sTargetPageURL in the Page_Load() event you can

Try
   sCallerPageURL = Request.QueryString("previousPage")
Catch
   sCallerPageURL = ""
End Try

B..G
0
 

Author Comment

by:bryker
ID: 9924173
Sorry I took so long in answering...there's just no excuse for forgetting it for this long.

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now