Hi,

I have created two web pages say first.asp and second.asp.
first.asp has a link of second.asp and username is embedded in url of second.asp.(second.asp?username=dvhsdghsdg)

Second.asp has a link for some https site say securelogin.asp and i want to access the server variable "referer Url" to retrieve username in https login page.

The issue is : When first time i access securelogin.asp from second.asp, referer url is empty. But when second time from same Second.asp page, its giving me proper referer url as as
"second.asp?username=dvhsdghsdg."

Both first.asp and second.asp are http and securelogin.asp is https.
Can this be the reason? If so then how can I get the referer url on first time access?
Please help me in this issue.

Regards,
anu

Recommended Answers

All 7 Replies

One more point..... I tried same in firefox and its working fine means I am able to retreive http_referer on first time access in mozilla but not in IE.

Anu

Dear Anu,
This is very complicated what you have written. The referer is only shown when a page is referred to by a click. That means, if you click on a link and get to a page, the first page is the referer. But if you enter the url into the browser, there is no referer.

If you have a link to a the securelogin.asp (securelogin.asp?username=blabla), then securelogin.asp can get the username easily by Request.QueryString. Please let me know if there is something I have not understood.

Good luck,
Ali Baradaran

Hi,

I want to access https://securelogin.asp from second.asp, it means http_referer in securelogin.asp should be second.asp?username=.

I can't pass username as embedded in the URL of securelogin.asp (some design issues).
So i have to use http_referer only.

Now the issue is in IE :
When first time i access (i.e. click on link) securelogin.asp(opens in different window) from second.asp page, then http_referer is empty. But if i click on same link in second.asp(which is already opened), then it returns the value of http_referer i.e. second.asp?username=value.
In Mozilla, no issues means first time itself I am able to get value of http_referer.
I hope, now you are clear with my problem.
Any help?

Thanks
Anu

Dear Anu,
I have never experiences such a problem before, therefore I can not explain why IE would not get the referrer data. Anyway, maybe you can bypass the problem by using a form and a hidden text input.

<form name="form_login" method="post" action="second.asp">
<input type="hidden" name="username" value="<%=Request.QueryString("username")%>" />
</form>

...
<a href="#" onclick="form_login.submit()">Login</a>
...

The link submits the form when clicked. This may solve your problem.

Good luck.
Ali Baradaran

Thanks.
But actually our deployment scenario is totally different.
i.e. Second.asp is our client website and securelogin.asp is our project .
And client wants to access their new project from theuir existing site and they don't want to do any changes in their web site code.

Consider as two different applications named as second.asp(which is http://) and securelogin.asp(which is https://).
And there is link of securelogin.asp in second.asp.

We have to make changes in our end i.e. in securelogin site to retrieve the http_referer whose value will be second.asp?username=value.

Any help?

Hi Anu,
This time I understood more. This is very complicated though. I assume your sites are on different servers. As your referrer is secured, the referrer information is actually not sent. At least not always and not by all browsers. I googled this matter and found a confirmation. Simply google for https http_referer.

As you are trying to pass information within two different sites, you have to either embed the username in the url or pass the data within the header.

I think you could manage to run the service on one browser like firefox or IE. But this is no stable service, as other browsers may not pass the referrer from a secured page.

Best regards,
Ali Baradaran

Thanks a lot Baradaran.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.