Results 1 to 4 of 4

Thread: Trying to retrieve webpage after logging in

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    33

    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?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    33

    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.

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    33

    Re: Trying to retrieve webpage after logging in

    Ideas?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width