asp.nethrefreferer

URL Referer not working on pop up windows


I have two pages namely www.abc.com/pg1.aspx and www.abc.com/pg2.aspx

pg1.aspx
response.redirect("www.abc.com/pg2.aspx");

pg2.aspx
string url_refer = Request.UrlReferrer.ToString();

UrlReferrer is working fine.

pg1.aspx
<a href='#' onclick=\"window.open('www.abc.com/pg2.aspx', 'windowname2', 'width=1014, height=709, screenX=1, left=1, screenY=1, top=1, status=no, menubar=no, resizable=no, toolbar=no'); return false;\">

pg2.aspx
string url_refer = Request.UrlReferrer.ToString();

UrlReferrer is NULL

I googled for the solution. but none of them are leading to the solution i want.

My problem is if the window is with no menubar, status or toolbar, UrlReferrer is NULL

if not, UrlReferrer has the previous page's URL.

I also tried url_refer = Request.ServerVariables["HTTP_REFERER"].ToString(); instead of string url_refer = Request.UrlReferrer.ToString();.

the result is the same.

Any solution?


Solution

  • I'm not sure.. but I found out..

    Session is not working if we call a new page using Javascripts.

    I was told that all session values are reset on a new page which is called using javascripts.

    As an alternative for my question, I used QueryString.

    I really don't want the users to see the URL but I already hide the URL with javascript.

    So, I have no problem using querystring, right?

    Does anyone hava a better solution?