Solved

Provide Authentication in Web Request of AxWebBrowser instance

Posted on 2007-12-06
5
258 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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