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

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    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

    Code:
        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)
                    Application.DoEvents()
                Loop
    
                Do Until .ReadyState = WebBrowserReadyState.Complete
                    Application.DoEvents()
                Loop
    
    
            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
                Else
    
                    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
    Location
    OAKLAND CA | Adam's Point (Fairyland)
    Posts
    14,954
    Rep Power
    8617
    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.
    medialint.com

    “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