Results 1 to 3 of 3

Thread: delete asp.net cookie using javascript

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245

    delete asp.net cookie using javascript

    Hi,

    I'm pretty new to asp.net so go easy on me if this is a really lame question.

    I have a login application in asp.net that creates a cookie.

    I want to use javascript to delete this cookie.

    Here's the code I use to create the cookie:

    Code:
        Public Function fnSetCookie(ByVal UID As String, ByVal Aff As String)
            ' set userid and affiliate values
            Response.Cookies("UserName").Value = UID
            Response.Cookies("UserName").Expires = DateTime.Now.AddYears(30)
            Response.Cookies("Affiliation").Value = Aff
            Response.Cookies("Affiliation").Expires = DateTime.Now.AddYears(30)
        End Function
    Here's the javascript I'm using:

    function LogOut(){
    document.cookie.expires="Thu, 01-Jan-70 00:00:01 GMT";
    window.location.reload();
    }

    Now I've figured out that the asp.net cookie is not placed in this directory:

    "C:\Documents and Settings\User Name\Cookies"

    So where is it stored? Is there any way to use javascript to remove the cookie the above vb.net code creates?

    Thanks in advance for any help you could provide.

    - Jake

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245
    Thanks for the link but that thread doesn't say anything about removing cookies using javaScript.

    I create a cookie in asp.net and want to remove it with JavaScript, can anyone tell me how to do this? My code above doesn't do the trick...

    - J

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