Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web browser control and bypassing authentication
Message
 
À
03/01/2005 02:13:20
Information générale
Forum:
ASP.NET
Catégorie:
Librairie contrôle Web
Divers
Thread ID:
00973739
Message ID:
00973865
Vues:
14
This is a Windows application having a Web browser control on a form. So, I cannot use this approach. Later on, I simply changed that method and made use of the HTTPWebRequest and the proxy objects.

Sorry, I forgot you mentioned you're using the IE Control inside the WinForm:

You'll also need this code:
// In the Initialize Component Method you'll need to add this line
this.WebBrowser.DocumentComplete += 
     new AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler
     (this.WebBrowser_DocumentComplete);


// in the WebBrowser_DocumentComplete Method you add:
// Get the Document Element
this.htmlDoc = (HTMLDocumentClass)WebBrowser.Document;

// Get a referrence to the UserName Text Box
HTMLInputElement txtUserName = 
     (HTMLInputElement)this.htmlDoc.all.item("txtUserName",0);
txtUserName.value = ConfigurationSettings.AppSettings["UserName"];

// Get a referrence to the Password Text Box
HTMLInputElement txtPassword = (HTMLInputElement)this.htmlDoc.all.item("txtPassword",0);
txtPassword.value = ConfigurationSettings.AppSettings["Password"];

// get the html button next 
HTMLInputElement buttonLogin = (HTMLInputElement)this.htmlDoc.all.item("btnSubmit",0);

btnSubmit.click();
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform