Solved

ASP.NET and JavaScript Redirection

Posted on 2003-11-19
2
1,136 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
Comment Utility
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
Comment Utility
Sorry I took so long in answering...there's just no excuse for forgetting it for this long.

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

9 Experts available now in Live!

Get 1:1 Help Now