Solved

Provide Authentication in Web Request of AxWebBrowser instance

Posted on 2007-12-06
5
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

627 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