I'm trying to log into a page, and retrieve the HTML, which can only be retrieved once I log in. If I used the URLexplicitly in the web browser, it works fine and I log in, but when I try to do it in the VB .NET code, it doesn't work. I provided the code below.Code:http://www.mywebsite.com/login.php?username=myusername&password=mypassword
Any ideas why this isnt working?Code:Private Sub btnSync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSync.Click Dim request As WebRequest = WebRequest.Create("http://www.mywebsite.com/login.php?username=myusername&password=mypassword") Dim response As WebResponse = request.GetResponse() Dim s As Stream = response.GetResponseStream() Dim sr As StreamReader = New StreamReader(s, Encoding.ASCII) Dim doc As String = sr.ReadToEnd() Debug.Print(doc) End Sub




Reply With Quote