Adding cookies issue

lleemon

Newcomer
Joined
May 2, 2006
Messages
3
I can get my httpwebrequest and httpwebresponse to work find for most sites but have stumbled accross a site that the cookies give me an error when it called that ccContainer.SetCookies below.

If I output the cookie before it tried to call .SetCookies I get the following:
JSESSIONID=0000HDtYsaUnQ3FipFBXEDq2V5F:-1;Path=/
storenameid=xxxxx;Domain=www.storenamedomain.com;Expires=Wed, 03-May-2006 07:07:46 GMT;Path=/
storenametypes=DOC~RAT;Domain=www.storenamedomain.com;Expires=Wed, 03-May-2006 07:07:46 GMT;Path=/
storenameuserinfo=REALNAME>FIRSTNAME LASTLAST~COMPANYNAME>ACTUAL COMPANY NAME HERE;Domain=www.storenamedomain.com;Expires=Wed, 03-May-2006 07:07:46 GMT;Path=/

I believe it has something to do with either the ';' or the , in the Expires section of each line.

Has anyone encountered this before?

Code:
.....
            m_hwrResponse = DirectCast(m_hwrRequest.GetResponse(), HttpWebResponse)

            srReader = New StreamReader(m_hwrResponse.GetResponseStream())
            sReturn = srReader.ReadToEnd()
            srReader.Close()


            If Not m_hwrResponse.Headers("Set-Cookie") Is Nothing Then
                txtOutput.Text = m_hwrResponse.Headers("Set-Cookie").ToString
                Dim ccContainer As New CookieContainer()

                ccContainer = New CookieContainer()
                ccContainer.SetCookies(m_hwrResponse.ResponseUri, m_hwrResponse.Headers("Set-Cookie"))
         m_ccCookies.Add(ccContainer.GetCookies(m_hwrResponse.ResponseUri))
            End If

            Me.Referer = m_hwrResponse.ResponseUri.AbsoluteUri
....

The returned err.Messege is:
An error has occured when parsing Cookie header for Uri 'url is provided'

Any thoughts?
 
Just an update; I do not get the error if the Domain=www.storenamedomain.com is removed from the cookie being added.
 
Back
Top