Forum Moderators: open

Message Too Old, No Replies

Need to pass HTTP_REFERER from meta refresh

sample asp code shown here - please assist

         

crashomon

2:45 pm on Sep 24, 2004 (gmt 0)

10+ Year Member



Hi, I've got a problem.

I'm trying to pass a HTTP_REFERER server variable to a page

Sample Code:
<%
Dim Domain
Dim uid
Dim restrictedurl

Domain = Request.ServerVariables("LOGON_USER")
uid = UCase(Right(Domain,(Len(Domain) - Instr(1,Domain,"\", vbTextCompare))))
restrictedurl = Request.ServerVariables("HTTP_REFERER")
%>

When its linked directly, the variables all show up fine using

Name: <%=uid %>
UserID: <%=Domain %>
URL: <%=restrictedurl %>

However, if using a "meta-refresh" the HTTP_REFERER Server variable shows blank (because its not being passed from the meta-refreshed originating page)

Anyone know how to pass the HTTP_REFERER server variable along?

TIA,

Patrick Elward

Lord Majestic

2:50 pm on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



However, if using a "meta-refresh" the HTTP_REFERER Server variable shows blank (because its not being passed from the meta-refreshed originating page)

Well, META refresh is performed by the client (browser), so I can't really see what you can do on server side to influence decision to pass or not pass the referer, which IMO should be passed.

crashomon

2:53 pm on Sep 24, 2004 (gmt 0)

10+ Year Member



This is true, but the refresh is being performed on the server (this is a corporate environment) and so, I'm just trying to see if its possible to edit something that would 'pass along' this value.

Thanks!

Patrick

Lord Majestic

3:05 pm on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As I said its the clients responsibility:

a) to perform META REFRESH
b) to pass referer

This is either behaviour by design (no referer passed in situation like that), or something wrong with client - perhaps some local firewall software that removes referer without browser's knowledge?

crashomon

4:07 pm on Sep 24, 2004 (gmt 0)

10+ Year Member



yes, you're correct.

I now have the redirect page's code:

<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.htm">

is there a way to 'pass along' this value in the string?

would I need to use javascript to do so?

Thanks,

Patrick

Lord Majestic

4:17 pm on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is there a way to 'pass along' this value in the string?

No! Its up to the client to decide whether to pass referer or not, and you have no control over it! Internet Explorer won't pass referer for windows opened with JavaScript, some other browsers do, it all depends on client.

I just did a test on my local machine and referer is not passed by Firefox and Explorer, however if you click on that URL referer is passed as intended. I therefore conclude that referer is not passed and not supposed to be passed (or both Firefox and IE teams are wrong).

You can try 302 Permanently moved response code to see if it gives better results than META REFRESH.

crashomon

4:41 pm on Sep 24, 2004 (gmt 0)

10+ Year Member



Okay, I'll keep looking for alternate solutions.

how about if I used this code in a body onload?

onload="window.navigate('index.asp');"

Is there a way to append the referrer value?

Thanks.

Patrick

mattglet

8:24 pm on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would this work?:

<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.htm?refer=<%=server.urlencode(request.servervariables("HTTP_REFERER"))%>">

Lord Majestic

8:34 pm on Sep 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This will give him referer as part of URL, but it won't be logged into normal log file referer field.