Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP_REFERER problem 1

Status
Not open for further replies.

trezlub

Programmer
May 2, 2003
67
GB
I have a page that calls another page upon submitting a form (page1 and page2). Within the called page (page2), there is a line of logic to redirect back to the calling page, i.e.

<%
Response.Redirect 'page1.asp'
%>

I would then expect that the value within the HTTP_REFERER server variable would be equal to 'page2.asp'. Instead it seems to retain the value of the calling page (page1). Can anyone help me? I have looked this up on this site and though I found examples of where people had the same problem I did not find a solution.
 
where do u call this HTTP_REFERER method (i think page 1?)

may i know why u want to use http_referer method?

Known is handfull, Unknown is worldfull
 
I do call HTTP_REFERER in page1.

I was using this method to return to a page upon a user attempting to login in to a site with a none existing account (or a false password). If I know that the user got to the login screen from a page that attempted to log them in I will know the details they entered were invalid in some way.
 
well u want the HTTP_REferer methos so that u can display 'Wrong info entered' in page 1?

i think a better way is sessions..

Known is handfull, Unknown is worldfull
 
I am not so sure using 'sessions' is a better way. It will us up a lot of space on the server if/when many users are logged in at the same time. Using HTTP_REFERER is faster and requires no space at all.

Any ideas why HTTP_REFERER is not updating?
 
i have no ideas, but there is another way

in page2
response.redirect (&quot;page1.asp?falied=true&quot;)

in page1

if request(&quot;failed&quot;)!=&quot;&quot; then
response.write &quot;Login failed.&quot;
end if

does this help?

about the referer stuff, i aint quite sure.

Known is handfull, Unknown is worldfull
 
I never use the querystring as it is about as secure as leaving your front door open.

Cheers anyway vbkris.

Can anyone help?
 
but in my method u dont pass any info that affects security...

Known is handfull, Unknown is worldfull
 
Sorry I can't help.

I always submit forms to themselves and process them in the same ASP file. It avoids both the insecurity of the querystring (though the querystring is useful for many other things) and the overhead of sessions, as well as the inability to get the right referrer. You might consider it as your solution.
 
that is true. Maybe I will do things your way. I still want an answer to why REFERER is not updating though.
 
maybe something must be written to the page before the page is recognised as a page?

since response.redirect is before anythin has been outputted mayebe that is causeing the error?

Known is handfull, Unknown is worldfull
 
hey trezlub,
what gives u the idea that sessions are created on the server?

do this:
in the client browser disable cookies, it will also disable SESSION!!!!
so from this i think we can safely conclude that a session is creted only in the client browser.

Correct me if i am wrong...

Known is handfull, Unknown is worldfull
 
You are wrong.

The session is created on the server. A cookie is sent to the browser with a unique value that is sent back to the server every time the page is requested and the server then looks up the session information based on the unique value for that user.

Beyond the simple unique value everything else about the session is stored on the server.
 
I do not know if this is true. Anyway, I wish to use cookies
 
o.k. got it.. :)

Known is handfull, Unknown is worldfull
 
Hmm. Page2.asp is reached through a standard POST form submission, right?
 
Wait, I don't get it. Page1 has the form, which is submitted to page2, right? Or page1 has part of the form and page2 has the rest?
 
OOps. My mistake. You were correct and I was wrong.

Page2.asp is reached through a standard POST form submission. Within Page2 we have a response.Redirect to take us back to page1. In page1 the HTTP_REFERER shows page1 and not page2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top