Solved

ASP.NET and JavaScript Redirection

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display

726 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