Solved

ASP.NET and JavaScript Redirection

Posted on 2003-11-19
2
1,139 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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