Click to See Complete Forum and Search --> : Cookies & Sessions question -
goddess_spanky
September 12th, 2001, 09:23 AM
I have a login page for a site that sets a cookie if the user is authenticated, this much works, but I also have an include file called verify.asp that checks to see if the cookie exists and is valid each time a page is loaded. The only problem is if the cookie expires or is deleted, the verify file doesn't catch this? I have the include statement at the top of the page (before any HTML tags) and I gave the pages an .asp extension even though they are mainly HTML.
Is there any reason why this isn't working? I'm still learning how to use cookies and session objects, but I am otherwise fairly proficient with ASP yet I can't figure this one out. Any ideas?
Thanks,
AD
~goddess
goddess_spanky@hotmail.com
Aindril De
September 12th, 2001, 10:37 AM
Hi,
What I feel is you need not use a seperate ASP file using the include statement as this may not be called properly. Therefore what you do is add the code for checking the cookie at the begining of the page where u ar using the include statement.
for eg:
'-------------------
u_name=Request.Cookies("validusers")
if u_name="" then
this means that the cookie is not there..
in this case u write the code to reset the cookies again
for eg:
Response.Cookies("validusers")=give here the variable name that holds the username..
Hope this helps..
Please Reply after checking
best of luck
Aindril De
goddess_spanky
September 12th, 2001, 12:33 PM
I also got this one to work, but thank you for the kick start in the right direction!
~goddess
goddess_spanky@hotmail.com
Aindril De
September 13th, 2001, 07:05 AM
Thanx.. ho we help each other like this in future also..
Aindril De
goddess_spanky
September 14th, 2001, 10:06 AM
Sorry, I wanted to post the solution I found in hopes that it may help someone else someday...
'If (Request.Cookies("User") = "") then
' Response.Cookies("User").Expires = date
' Response.Cookies("Authenticated")=""
' session.Abandon()
'Response.Write"parent.location.replace'('http://mysite/errlogin.asp')"
'elseif (Request.Cookies("Authenticated") = "No") then
' Response.Cookies("Authenticated").Expires = date
' Response.Cookies("User") = ""
' Session.Abandon()
' Response.Write("parent.location.replace('http://mysite/errlogin.asp')")
'End If
~goddess
goddess_spanky@hotmail.com
Aindril De
September 15th, 2001, 08:58 AM
Thanx a lot I'll try this out and reply you..
take care
regards
Aindril De
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.