Cookie Validation

Results 1 to 3 of 3

Thread: Cookie Validation

  1. #1
    Mark Smith Guest

    Default Cookie Validation

    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&#039;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?<BR><BR>&#060;%<BR>If Request.Cookies("loginok")&#060;&#062;"" Then<BR>Do Nothing<BR>else<BR>Response.Redirect("accessdenied .html")<BR>end if<BR>%&#062;<BR><BR>Thanks<BR>Mark

  2. #2
    Dalibor Sver Guest

    Default RE: Cookie Validation

    I would suggest you to use Session variables - it&#039;s really easy:<BR>after successful login, you have (on the same page!):<BR>session("strLetsGo")="OK"<BR><BR>on the top of every page you have:<BR>&#060;%<BR>if session("strLetsGo")="OK" then<BR> %&#062;<BR> page goes on...<BR> &#060;%<BR>else<BR> response.redirect("loginformname")<BR><BR>&#039; or <BR><BR> %&#062;<BR> &#060;script&#062;<BR> window.location.href=&#039;loginformname&#039;;<BR > &#060;/script&#062;<BR> &#060;%<BR>&#039; or just<BR><BR> response.end<BR><BR>end if<BR>%&#062;<BR><BR><BR>There are many ways to perform security. But this is the easiest (and the least secure unfortunatelly) but I hope this will do.

  3. #3
    Mark Smith Guest

    Default RE: Cookie Validation

    Thanks for your help!<BR>Looks to have sorted the problem out.<BR><BR>Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts