Custom cookies folders are mixed up.

Discussion in 'Visual Basic .NET' started by flann, Jun 16, 2012.

  1. flann

    flann Regular Member

    Joined:
    Jan 19, 2008
    Messages:
    208
    Likes Received:
    34
    I have a application created in VB. Now i need the app to have its own cookies folder. I have done that, but it is not working as it should.

    example: I start app/bot 1 and the cookies folder willl be set to \bot1\. When i use the webbrowser in the app all cookies are stored in the right folder. Now i start app2/bot2 the cookies will be stored in the \bot1\ folder and not in the \bot2\ folder. After i restart app2/bot2 the cookies are stored in the right folder. But now cookies from app1 are also stored in \bot2\.

    I think i change the cookies folder the wrong way. Now my apps are changing the global cookies folder and not just for the app i choose.
    If i use IE after i loaded app1 or app2, the cookies from IE are also stored in the \app1\ or \app2\ folder. :(


    This is the code i use to change the cookies folder for app1:
    Code:
    Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey( _
    "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", True)
            key.SetValue("Cookies", "%USERPROFILE%\APP1")
    This is the code i use to change the cookies folder for app2:
    Code:
    Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey( _
    "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", True)
            key.SetValue("Cookies", "%USERPROFILE%\APP2")
    I put this code on 2 places to be sure ;)
    1.) below this line:
    Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.) and in the button code like this:
    Code:
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            RefreshIESettings(TextBox4.Text)
            Dim key As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey( _
    "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", True)
            key.SetValue("Cookies", "%USERPROFILE%\APP1")
    
            WebBrowser1.Navigate("https://WEBSITE-NEED-TO-SAFE-THIS-COOKIES-IN-CUSTOM-FOLDER")
    
    
    
        End Sub


    Am i on the right way? What to change?
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,870
    Likes Received:
    12,622
    Occupation:
    Potentate
    Location:
    Asuncion
    I don't think you can do it trivially, as IE does not support this. Look in the forum, if I remember correctly someone had suggesting hacking a specific dll.
     
  3. flann

    flann Regular Member

    Joined:
    Jan 19, 2008
    Messages:
    208
    Likes Received:
    34
    Are you sure it is for VB? Can't find anything related to my problem. i see a lot of the same questions on the interwebs but no answers :(

    Can i use cookie containers with webbrowser? So i can safe and use specific cookies folders?
     
  4. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,870
    Likes Received:
    12,622
    Occupation:
    Potentate
    Location:
    Asuncion
    Well, hacking a dll is regardless of language, so not on VB. I just remember someone said here it could be done by messing around with a dll.

    I can't give you specific advice, I never use webcontrol. Try using a different browser control if you need multitasking/multithreading.