CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2001
    Location
    Salt Lake City, UT
    Posts
    135

    Cookies & Sessions question -

    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
    [email protected]
    "There are no stupid questions, but there are a lot of inquisitive idiots."

  2. #2
    Join Date
    Aug 2001
    Posts
    45

    Re: Cookies & Sessions question -

    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

  3. #3
    Join Date
    Apr 2001
    Location
    Salt Lake City, UT
    Posts
    135

    Re: Cookies & Sessions question -

    I also got this one to work, but thank you for the kick start in the right direction!

    ~goddess
    [email protected]
    "There are no stupid questions, but there are a lot of inquisitive idiots."

  4. #4
    Join Date
    Aug 2001
    Posts
    45

    Re: Cookies & Sessions question -

    Thanx.. ho we help each other like this in future also..

    Aindril De

  5. #5
    Join Date
    Apr 2001
    Location
    Salt Lake City, UT
    Posts
    135

    Re: Cookies & Sessions question -

    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
    [email protected]
    "There are no stupid questions, but there are a lot of inquisitive idiots."

  6. #6
    Join Date
    Aug 2001
    Posts
    45

    Re: Cookies & Sessions question -

    Thanx a lot I'll try this out and reply you..
    take care
    regards

    Aindril De

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured