Solved

Provide Authentication in Web Request of AxWebBrowser instance

Posted on 2007-12-06
5
256 Views
Last Modified: 2013-11-07
I am using the COM AxWebBrowser in a VS 2003 (1.1) project to access a password protected area of a website.  I need to pass a predefined auth so as not to burden the EU with auth'ing when they have already done so to use the app.  How do I pass that as part of the web request/flags/options?
0
Comment
Question by:dmoring
  • 2
5 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 20428993
One way is this.. That is how i login to yahoo.
Prerequisite is that you are not logged in already to yahoo.

To test.. Open in browser mail.yahoo.com
and you if you are already logged in, then sign out..

Then run the code which i have placed in the sample by changing your username and password string and you will automatically login to the mail of yahoo page
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        AxWebBrowser1.Navigate2("mail.yahoo.com")

    End Sub

    Dim bool As Boolean

    Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete

        If Not bool Then

            bool = True

            CType(CType(AxWebBrowser1.Document, mshtml.HTMLDocument).getElementById("username"), mshtml.HTMLInputElement).value = "yourusername"

            CType(CType(AxWebBrowser1.Document, mshtml.HTMLDocument).getElementById("passwd"), mshtml.HTMLInputElement).value = "yourpassword"

            CType(CType(AxWebBrowser1.Document, mshtml.HTMLDocument).getElementById("login_form"), mshtml.HTMLFormElement).submit()

        End If

    End Sub

Open in new window

0
 

Author Comment

by:dmoring
ID: 20429070
armoghan, thanks for your reply.  No, I'm not talking about forms-based auth, but the permissions based auth (i.e., the IE-based "popup" that occurs when the page is accessed).  Since I know that it is permissions-protected, it seems to me I can initiate a request with the auth in the post...
0
 
LVL 18

Accepted Solution

by:
armoghan earned 500 total points
ID: 20440097
you can also try the webclient or web request way to login
This thread may be useful in this regard
http://www.dotnet247.com/247reference/msgs/52/264260.aspx
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20632927
Forced accept.

Computer101
EE Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now