Note that there are some explanatory texts on larger screens.

plurals
  1. POHttpWebRequest, WebBrowser, and cookies? (visual basic 2010)
    primarykey
    data
    text
    <p>I'm writing a program for my sister for a game which she plays online. It uses a WebBrowser control, and HttpWebRequest as well.</p> <p>The basic function is it searches through the website, we'll say the url is <a href="http://hersite.com/pet/" rel="nofollow">http://hersite.com/pet/</a>* (don't follow the link lol it's just an example) where * is a number and this is how it searches. I use a for loop to cycle the numbers from a specified start to end, and use an httpwebrequest to fetch the html code, then process the string using InStr and .split()</p> <p>When I access the webpage using the WebRequest.Navigate, it takes me to the page correctly. However, if I fetch the source through the HttpWebRequest, it fetches the source of the login page, which the website redircts you to if you are not logged in.</p> <p>Is there a way to transfer the cookies from the WebBrowser to my HttpWebRequest?</p> <p>I hope this is clear.</p> <p>Some examples:</p> <p>Get the HTML somewhere in here I need to add the cookie to the http requester, don't I?</p> <p>Function GetHTML(ByVal strPage As String) As String Dim strReply As String = "NULL"</p> <pre><code> Try Dim objHttpRequest As System.Net.HttpWebRequest Dim objHttpResponse As System.Net.HttpWebResponse Dim uri As New Uri(strPage) objHttpRequest = System.Net.HttpWebRequest.Create(strPage) objHttpResponse = objHttpRequest.GetResponse Dim objStrmReader As New StreamReader(objHttpResponse.GetResponseStream) strReply = objStrmReader.ReadToEnd() Catch ex As Exception strReply = "ERROR! " + ex.Message.ToString End Try Return strReply End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload