1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Rep Power

    Only show log in fail/success when on certain page in webbrowser

    I created this script for a program that logs into a website (any website). My code starts out as

        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            With WebBrowser1
                Do Until Not (.IsBusy)
                Do Until .ReadyState = WebBrowserReadyState.Complete
            End With
            Dim htmlText As String
            If Not (WebBrowser1.Document.Body.InnerHtml) Is Nothing Then
                htmlText = WebBrowser1.Document.Body.InnerHtml
                If InStr(htmlText, "Microsoft account") Then
                    MessageBox.Show("You have entered in a wrong password or the account doesn't exist.")
                    'code to go here if it is true
                    MessageBox.Show("Sign in successful. Proceed on...")
                    'code to go here if it is false
                End If
            End If
        End Sub
    As you can see it alerts the user if they have typed in the correct email or the wrong email. My main problem with this script now, is that it alerts the user whatever page they're on. After logging in, say you click on Home or another link that leads to somewhere, it will most likely say "You have entered in a wrong password or the account doesn't exist." because it isn't defined to be only for one url. So I'm having trouble coding this, somehow I need to make it to where it waits until URL (certain url) is loaded, then load the rest of the code. Is that possible?
  2. #2
  3. Type Cast Exception
    Devshed Supreme Being (6500+ posts)

    Join Date
    Apr 2004
    OAKLAND CA | Adam's Point (Fairyland)
    Rep Power
    Typically you'd create a session and store the session ID as a cookie thereafter any page on your site checks the session status as needed.

    “Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss

IMN logo majestic logo threadwatch logo seochat tools logo