Hi, so I have a program that's using HttpWebRequests and the user logs in, it stores the login on a cookie, but when i try to navigate somewhere on the site i have it log in on, it wont send the cookies. Here's some of my code:
obviously where it says "SITE", it's really the site url. And the uniqueid and hashidentifier i didn't really want to post public
/>
So the button2 webrequest seems to work fine and it stores the cookie to a global variable, the issue comes with button3. When i click button3, it seems to post through fine, but the cookie isn't sent so i get the websites response of not having a cookie included. I know the cookie isn't posted also because when i traced my program with fiddler i got this in the cookie section: "This request did not send any cookie data." However when i actually do it from a browser where the browser stores the cookie i get this: "Request sent 348 bytes of Cookie data:
asc=CookieDataHere". It also appears that the cookie doesn't appear in the header when i do it. Any and all help is greatly appreciated. Thanks in advance.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://SITE/index.php?version=1.76&premium=true&udid=UNIQUEIDENTIFIER&pf=HASHEDIDENTIFIER&model=iPhone&sv=5.1.1"), HttpWebRequest) postReq.AllowAutoRedirect = False postReq.Method = "GET" postReq.Host = "SITE" postReq.KeepAlive = True 'postReq.Referer = "http://SITE/index.php?" postReq.ContentType = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" postReq.CookieContainer = theCookie postReq.UserAgent = userage Dim response As HttpWebResponse = DirectCast(postReq.GetResponse, HttpWebResponse) Dim reader As New StreamReader(response.GetResponseStream()) Dim home As String = reader.ReadToEnd RichTextBox1.Text = home WebBrowser1.DocumentText = home End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://SITE/profile.php"), HttpWebRequest) Dim webHeaders As WebHeaderCollection = postReq.Headers webHeaders.Add("Accept-Language: en-us") webHeaders.Add("Accept-Encoding: gzip, deflate") webHeaders.Add("Cache-Control: max-age=0") webHeaders.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3") postReq.Referer = "http://SITE/home.php" postReq.CookieContainer = theCookie postReq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" postReq.Host = "SITE" postReq.KeepAlive = False postReq.UserAgent = userage postReq.AllowAutoRedirect = False Dim response As HttpWebResponse = DirectCast(postReq.GetResponse, HttpWebResponse) Dim reader As New StreamReader(response.GetResponseStream()) Dim home As String = reader.ReadToEnd RichTextBox1.Text = home WebBrowser1.DocumentText = home End Sub
obviously where it says "SITE", it's really the site url. And the uniqueid and hashidentifier i didn't really want to post public

So the button2 webrequest seems to work fine and it stores the cookie to a global variable, the issue comes with button3. When i click button3, it seems to post through fine, but the cookie isn't sent so i get the websites response of not having a cookie included. I know the cookie isn't posted also because when i traced my program with fiddler i got this in the cookie section: "This request did not send any cookie data." However when i actually do it from a browser where the browser stores the cookie i get this: "Request sent 348 bytes of Cookie data:
asc=CookieDataHere". It also appears that the cookie doesn't appear in the header when i do it. Any and all help is greatly appreciated. Thanks in advance.