Results 1 to 5 of 5

Thread: [RESOLVED] clear cookies

  1. #1

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Resolved [RESOLVED] clear cookies

    hi all
    is there a way to clear cookies???

    i've currently worked this out but i don't know why it doesn't work...

    System.IO.File.Delete("C:\Documentes and Settings\" & Environment.UserName.ToString & "Cookies\")

  2. #2
    Addicted Member phenom's Avatar
    Join Date
    Apr 2006
    Location
    UAE
    Posts
    233

    Re: clear cookies

    Quote Originally Posted by JXDOS
    hi all
    is there a way to clear cookies???

    i've currently worked this out but i don't know why it doesn't work...

    System.IO.File.Delete("C:\Documentes and Settings\" & Environment.UserName.ToString & "Cookies\")
    to access the Cookies Folder use this code:
    VB Code:
    1. Environment.SpecialFolder.Cookies()

    Regards,
    =======================================
    If I helped you, Kindly Rate my post. Thanks
    -----------
    PHENOM

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: clear cookies

    You aren't specifying a file to delete. You've specified a folder. If you want to delete all cookies then you'd need to get a list of all the cookie files and then delete each one.
    VB Code:
    1. For Each cookieFile As String In IO.Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Cookies), "*.txt")
    2.     Try
    3.         IO.File.Delete(cookieFile)
    4.     Catch
    5.     End Try
    6. Next cookieFile
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: clear cookies

    it worx! it worx! thank a lot!

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: clear cookies

    Don't forget to resolve your thread from the Thread Tools menu.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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