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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie Validation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a page in which users log into my website. If the login is successful, then a cookie named loginok is sent to them. I need all the other pages on the website to check for this cookie's existence before allowing users access to any pages. I have tried the code below at the top of each of my pages but have had no success. I basically check to see if loginok is smaller or greater than "" but this doesnt seem to work. Is there a way of just checking to see if the cookie exists? Can someone please help?

<%
If Request.Cookies(&quot;loginok&quot;)<>&quot;&quot; Then
Do Nothing
else
Response.Redirect(&quot;accessdenied.html&quot;)
end if
%>

Thanks
Mark
 
Maybe this alternative is workable:
In my LOGIN.ASP i ask & check the user-id/password combination. When this is is valid i change the session variable &quot;allow&quot;:

session(&quot;allow&quot;) = True


EVERY ASP program starts with this line:

If session(&quot;allow&quot;) = False Then Response.Redirect &quot;login.asp&quot;


br
Gerard
(-:




br
Gerard
(-:
 
Although mine is not a login, I'm having the same problem with Cookies:

[tt]Elseif Request.Cookies(&quot;COUNTIES&quot;) = &quot;&quot; Then (etc.)[/tt]

does not seem to work. I need to use Cookies though, rather than a session since I want the user to be able to go back to the site at a later date and find it in the same state in which they left it but if a Cookie has not been set, then I want to redirect them with the above to a page where thay can make the selection. In other words, once they choose their default county, I don't want them to have to choose it again the next time. Can this be done?
Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top