Get Certifcate from webpage to log-in RRS feed

  • Question

  • Is it possible to log-in by getting a certifcate from a website I need the code I have below works for most sites but the one I need it for wont work due to a certifcate I believe and have permission to log-in automatically if that makes sense the code i as shows below:

    Sub Test1()
        Const cURL = ""
        Const cUsername = "XXXX"    'REPLACE XXXX WITH YOUR USER NAME
        Const cPassword = "YYYY"    'REPLACE YYYY WITH YOUR PASSWORD
        Dim IE As InternetExplorer
        Dim doc As HTMLDocument
        Dim LoginForm As HTMLFormElement
        Dim UserNameInputBox As HTMLInputElement
        Dim PasswordInputBox As HTMLInputElement
        Dim SignInButton As HTMLInputButtonElement
        Dim HTMLelement As IHTMLElement
        Set IE = New InternetExplorer
        IE.Visible = True
        IE.navigate cURL
        'Wait for initial page to load
        Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
        Set doc = IE.Document
        'Get the only form on the page
        Set LoginForm = doc.forms(0)
        'Get the User Name textbox and populate it
        Set UserNameInputBox = LoginForm.elements("ctl00$ct$UserName")
        UserNameInputBox.Value = cUsername
        'Get the password textbox and populate it
        Set PasswordInputBox = LoginForm.elements("ctl00$ct$Password")
        PasswordInputBox.Value = cPassword
        'Get the form input button and click it
        Set SignInButton = LoginForm.elements("ctl00$ct$uxBtnLogin")
        'Wait for the new page to load
        Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
        'Get the HTML document of the new page
        Set doc = IE.Document
        'Determine whether login succeeded or not
        If InStr(doc.body.innerText, "Invalid Login Information") = 0 Then
            MsgBox "Login succeeded"
            MsgBox "Login failed"
        End If
        Debug.Print "Current URL: " & IE.LocationURL
    End Sub

    This is code I had aquired via a different site, It just needs some modifying of my own.

    Many Thanks

    Wednesday, November 6, 2013 9:06 AM