This is a discussion on "HTTP_REFERRER" within the Classic ASP section. This forum, and the thread "HTTP_REFERRER are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
HTTP_REFERRER
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
HTTP_REFERRER
I've got what should be a simple problem that is beyond me. A page that requires login calls the login page and sends the URL of that page, so the login page will return to the requesting page. The URL is being sent to the login page. If I do <%=response.write XXX%> on the form of the login page, it shows "/cart.asp", which is correct. But, the login page will not return to "/cart.asp", it goes to default.asp.
Is there some little something in the syntax that is not quite right? Thanks for any all assistance. Ernest <% Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "Cache-Control", "no-cache" Dim HTTP_REFERRER, UserObject Status = "Please log in." HTTP_REFERRER = Request.querystring("HTTP_REFERRER") If Request.Form("username") <> "" Then If Login Then ' MODIFY THE SESSION VARIABLE AS REQUIRED Session("UID") = UserObject.Item("EmailUserId") Set Session("UID") = UserObject If HTTP_REFERRER = "" Then Response.Redirect "../default.asp" Else Response.Redirect 'HTTP_REFERRER' End If Else Response.Redirect "loginfailed.asp" End If End If Function Login Dim conn, rs, sql, dbFIle dbFile = "EmailUser" Set conn = Server.CreateObject("ADODB.Connection") conn.open ="Provider=sqloledb;Data Source=xxxxx,1433;Network Library=DBMSSOCN;Initial Catalog=xxxxx;User Id=xxxxx;Password=xxxxxx;" Set rs = Server.CreateObject("ADODB.Recordset") sql = "SELECT * FROM EmailUser WHERE (NOT (U_Access = 0)) And U_ID = '" & Request.Form("Username") & "' AND U_Password = '" & Request.Form("Password")& "'" rs.Open sql, conn, 3, 3 If Not rs.EOF Then Set UserObject = CreateObject("Scripting.Dictionary") For each field in rs.Fields UserObject.Add field.name, field.value Next Login = True Else Login = False End If rs.Close set rs = nothing conn.Close set conn = nothing End Function %> |
|
|
|
|||
|
<s>on Line 5 use:
Request.servervariables("HTTP_REFERRER") instead of: Request.querystring("HTTP_REFERRER")</s> Oh wait I see what your doing.... Does the querystring look like this: login.asp?HTTP_REFERRER=cart.asp |
|
|||
|
Thanks for the reply. That address bar on the login page shows: http://southeastplaza.com/user/login...RRER=/cart.asp.
But I'm still being redirected to the default page. The login page is two folders down in the directory tree. If I set response.redirect to "/cart.asp" it returns, so I'm thinking that the directory structure is not the problem. I have changed the line: Response.Redirect 'HTTP_REFERRER' to double quotes and no quotes. Thanks Ernest |
|
|||
|
You're going to have problems passing a URL via Querystrings.
Since you are already using Sessions, why not store the referring page as a session variable during the login check? |
|
|||
|
you have spelt referer wrong, its "referer", not "referrer".
|
|
||||
|
I just spotted this thread.... so here goes:-
to link to the login page use something like this:-
Hope this helps:-
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
![]() |
| Tags |
| http_referrer |
| Thread Tools | |
|
|