Solved

ASP.NET and JavaScript Redirection

Posted on 2003-11-19
2
1,145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

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 shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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