|
-
Dec 31st, 2007, 09:52 AM
#1
Thread Starter
Member
Trying to retrieve webpage after logging in
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 URL
Code:
http://www.mywebsite.com/login.php?username=myusername&password=mypassword
explicitly 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:
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
Any ideas why this isnt working?
-
Dec 31st, 2007, 09:56 AM
#2
Re: Trying to retrieve webpage after logging in
what result do you get?
Also what horribly insecure website passes the username and password across a query string?
-
Dec 31st, 2007, 10:08 AM
#3
Thread Starter
Member
Re: Trying to retrieve webpage after logging in
I just get the web page that says "Invalid Login, Please try again". Its basically just a rejection page that you would get if you typed in your username and password incorrectly.
-
Jan 1st, 2008, 03:35 AM
#4
Thread Starter
Member
Re: Trying to retrieve webpage after logging in
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|