Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Recreate CookieContainer Issue (Loading from Textfile)

Thread closed. I have figured it out.

The issue if anyone ever has the problem themselves is that specifying a "Domain" is automatically registered as a sub-domain. To add to the parent site you must specify a URI instead. Here's how I fixed it.

Code
Public Shared Function ReturnLoginSession(ByVal Form As FrmMain, ByVal Profile As String) As CookieContainer
        For Each LoginSession As LoginSession In LoginSessionList
            If LoginSession.Profile.ToLower.Equals(Profile) Then
                Dim CookieContainer As New CookieContainer
                For Each Cookie As Cookie In LoginSession.Cookies
                    If Not Cookie.Domain.StartsWith("."c) Then
                        Dim NewCookieContainer As New CookieContainer()
                        Dim NewCookies As New Cookie()
                        With NewCookies
                            .Name = Cookie.Name
                            .Version = Cookie.Version
                            .Comment = Cookie.Comment
                            .CommentUri = Cookie.CommentUri
                            .Discard = Cookie.Discard
                            .Expired = Cookie.Expired
                            .Expires = Cookie.Expires
                            .HttpOnly = Cookie.HttpOnly
                            .Path = Cookie.Path
                            .Port = Cookie.Port
                            .Secure = Cookie.Secure
                            .Value = Cookie.Value
                        End With
                        CookieContainer.Add(New Uri(String.Format("http://{0}", Cookie.Domain)), NewCookies)
                    Else
                        CookieContainer.Add(Cookie)
                    End If
                Next
                Form.AppendTextBoxText(Form.TxtChat, String.Format("Setting saved session for account: {0}...", Profile))
                Return CookieContainer
            End If
        Next
        Return New CookieContainer
    End Function

Hope this helps.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SIM-5063966Jan 26, 2022 10:14 AM 4 278 Jan 26, 2022 10:14 AM
Last Post: mose3c
[C#] by KαѕρerAug 24, 2019 07:48 PM 9 347 Aug 24, 2019 07:48 PM
Last Post: Claw
[C#] by TunabishJun 16, 2018 12:00 PM 9 306 Jun 16, 2018 12:00 PM
Last Post: 0xDEAD10CC