How bypass integrated authentication using WebBrowser control?
Well, sometime back, I was hosting the WebBrowser control over WinForm and I wanted to access a remote/secure(https) website; The website was throwing a windows authentication dialog box whenever the url was typed in.
Fig1: The well known network credentials popup dialog box
This started bugging me and my program as well; since I wanted my program to automate this behavior and provide the credentials “hautomatically” (handle-automatically :0) So I told myself, issues are sweet, that’s how you get to learn more; Lets get sweetened!
Therefore, with absolute positive energy, I dived into google, and my “at-the-moment-favourite” – overflowing stack
Now the question was how to provide integrated authentication while having no access to the site, that is, my integrated windows credentials are not valid for the remote site; So how to force a different credential(other than the logged in one) plus override the WebBrowser credentials popup prompt.
Note, for those, who are in a hurry and running after the unstretchable deadline, please close your eyes - copy and paste the "The Code" section in your .NET WinForm application... and follow following steps:
STEP 1: Create a plain windows form application, double click over the form in design more to implement its OnLoad event.
STEP 2: Copy paste all of the code in the FormTest.cs file
...and well, hit the Run!
-- UPDATE 2011/04/09 --
Please download the zipped solution (.SLN) from here. Thanks to Eduardo for his feedback.
Rest, please follow.
STEP 1: Create a plain windows form application, double click over the form in design more to implement its OnLoad event.
STEP 2: Copy paste all of the code in the FormTest.cs file
...and well, hit the Run!
-- UPDATE 2011/04/09 --
Please download the zipped solution (.SLN) from here. Thanks to Eduardo for his feedback.
Rest, please follow.
There are four types of authentication, Windows, Forms, Passport, and None. Usual use is of the forms based authentication and integrated windows authentication (IWA). My scenario obviously had an integrated authentication system; and the logged in user is popped up with a window for required credentials.

Fig 2: [Illustration by Vesku’s blog]
Following is somewhat, in most cases, a generic site authentication process:
Fig 3: [Illustration by IBM] A generic authentication flow.
For this, following interfaces needed implementation. IAuthenticate, IServiceProvider, IOleClientSite;
IAuthenticate, is used by the WebBrowser object to automatically retrieve the user credentials and provides it to the website upon request.
Urlmon.dll uses the QueryInterface method on the client application's implementation of IBindStatusCallback to get a pointer to the client application's IAuthenticate interface.If the client application is hosting Mshtml.dll, Mshtml.dll requests a pointer to the client application's implementation of IAuthenticate interface by calling QueryInterface on the client application's IServiceProvider interface.
IOleClientSite, is used to notify the WebBrowser about the website that is going to require the credentials.
Within a compound document, each embedded object has its own client site — the place where it is displayed and through which it receives information about its storage, user interface, and other resources. IOleObject::SetClientSite is the only method enabling an embedded object to obtain a pointer to its client site.
A container can notify an object of its client site either at the time the object is created or, subsequently, when the object is initialized.
The IServiceProvider interface is a generic access mechanism to locate a GUID-identified service that is provided through a control or any other object that the service can communicate with. For example, an embedded object (such as an OLE control) typically communicates only with its associated client site object in the container through the IOleClientSite interface that is supplied by using IOleObject::SetClientSite. The embedded object must ask the client site for some other service that the container supports when that service might not be implemented in the client site.
The client site must provide a means by which the control that is managed by the site can access the service when necessary. For example, the IOleInPlaceSite::GetWindowContext function can be used by an in-place object or control to access interface pointers for the document object that contains the site and the frame object that contains the document.
Because these interface pointers exist on separate objects, the control cannot call the site's QueryInterface to obtain those pointers. Instead, use the IServiceProvider interface.
The IServiceProvider interface has only one member, QueryService, through which a caller specifies the service ID (SID, a GUID), the IID of the interface to return, and the address of the caller's interface pointer variable.
The Code
Following is how IOleObject is going to be implemented into your windows form;
[ComImport,
Guid("00000112-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleObject
{
void SetClientSite(IOleClientSite pClientSite);
void GetClientSite(IOleClientSite ppClientSite);
void SetHostNames(object szContainerApp, object szContainerObj);
void Close(uint dwSaveOption);
void SetMoniker(uint dwWhichMoniker, object pmk);
void GetMoniker(uint dwAssign, uint dwWhichMoniker, object ppmk);
void InitFromData(IDataObject pDataObject, bool
fCreation, uint dwReserved);
void GetClipboardData(uint dwReserved, IDataObject ppDataObject);
void DoVerb(uint iVerb, uint lpmsg, object pActiveSite,
uint lindex, uint hwndParent, uint lprcPosRect);
void EnumVerbs(object ppEnumOleVerb);
void Update();
void IsUpToDate();
void GetUserClassID(uint pClsid);
void GetUserType(uint dwFormOfType, uint pszUserType);
void SetExtent(uint dwDrawAspect, uint psizel);
void GetExtent(uint dwDrawAspect, uint psizel);
void Advise(object pAdvSink, uint pdwConnection);
void Unadvise(uint dwConnection);
void EnumAdvise(object ppenumAdvise);
void GetMiscStatus(uint dwAspect, uint pdwStatus);
void SetColorScheme(object pLogpal);
}
IOleClientSite requires following implementation:
[ComImport,
Guid("00000118-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleClientSite
{
void SaveObject();
void GetMoniker(uint dwAssign, uint dwWhichMoniker, object ppmk);
void GetContainer(object ppContainer);
void ShowObject();
void OnShowWindow(bool fShow);
void RequestNewObjectLayout();
}
IServiceProvider has following:
[ComImport,
GuidAttribute("6d5140c1-7436-11ce-8034-00aa006009fa"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown),
ComVisible(false)]
public interface IServiceProvider
{
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int QueryService(ref Guid guidService, ref Guid riid, out IntPtr
ppvObject);
}
[ComImport, GuidAttribute("79EAC9D0-BAF9-11CE-8C82-00AA004BA90B"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown),
ComVisible(false)]
public interface IAuthenticate
{
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int Authenticate(ref IntPtr phwnd,
ref IntPtr pszUsername,
ref IntPtr pszPassword
);
}
You may implement your form class like following:
public partial class FrmTest : Form, IOleClientSite, IServiceProvider, IAuthenticate
{
public static Guid IID_IAuthenticate = new Guid("79eac9d0-baf9-11ce-8c82-00aa004ba90b");
public const int INET_E_DEFAULT_ACTION = unchecked((int)0x800C0011);
public const int S_OK = unchecked((int)0x00000000);
public FrmTest()
{ InitializeComponent(); }
private void button1_Click(object sender, EventArgs e)
{
string oURL = this.textBox1.Text;
webBrowser1.Navigate(oURL);
}
Note, that now, when we host the WebBrowser control and implement the IAuthenticate interface to programmatically bypass the authentication process, sometimes Internet Explorer does not call the Authenticate function, which causes an authentication dialog to appear. So, this is somewhat buggy.
So, the workaround is to; "first" move to "about:blank" i.e.: Navigate("about:blank"), before moving to the secure site.
private void FrmTest_Load(object sender, EventArgs e)
{
//Navigate to about:blank
string oURL = "about:blank";
webBrowser1.Navigate(oURL);
//Notify the WebBrowser object about the client site.
//The client site, informs an embedded object of its display location
object obj = webBrowser1.ActiveXInstance;
IOleObject oc = obj as IOleObject;
oc.SetClientSite(this as IOleClientSite);
}
IOleClientSite member definitions:
public void SaveObject()
{
// TODO: Add FrmTest.SaveObject implementation
}
public void GetMoniker(uint dwAssign, uint dwWhichMoniker, object
ppmk)
{
// TODO: Add FrmTest.GetMoniker implementation
}
public void GetContainer(object ppContainer)
{
ppContainer = this;
}
public void ShowObject()
{
// TODO: Add FrmTest.ShowObject implementation
}
public void OnShowWindow(bool fShow)
{
// TODO: Add FrmTest.OnShowWindow implementation
}
public void RequestNewObjectLayout()
{
// TODO: Add FrmTest.RequestNewObjectLayout implementation
}
Interface IServiceProvider explicit implementation:
public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject)
{
int nRet = guidService.CompareTo(IID_IAuthenticate); // Zero returned if the compared objects are equal
if (nRet == 0)
{
nRet = riid.CompareTo(IID_IAuthenticate); // Zero returned if the compared objects are equal
if (nRet == 0)
{
//This method returns an interface pointer that represents the requested interface on the specified object. It is particularly useful if you have an unmanaged method that expects to be passed an interface pointer; Add to the COM interface reference count.
ppvObject = Marshal.GetComInterfaceForObject(this, typeof(IAuthenticate));
return S_OK;
}
}
ppvObject = new IntPtr();
return INET_E_DEFAULT_ACTION;
}
The main, IAuthenticate implementation
public int Authenticate(ref IntPtr phwnd, ref IntPtr pszUsername,
ref IntPtr pszPassword)
{
//Copies the contents of a managed String to a block of memory allocated from the unmanaged COM task allocator.
IntPtr strUser = Marshal.StringToCoTaskMemAuto(txtUserID.Text);
IntPtr strPassword = Marshal.StringToCoTaskMemAuto(txtPassword.Text);
pszUsername = strUser;
pszPassword = strPassword;
return S_OK;
}
}
Here is how to pass the proxy credentials in WebBrowser control:
Uri uri = new Uri("http://www.somewheresurl.com");
//Alternatively, you may use System.Text.UnicodeEncoding.UTF8.GetBytes()
string additionalHeaderInfo = "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("MyUsername" + ":" + "MyPassword")) + System.Environment.NewLine;
webBrowser1.Navigate(uri, null, null, additionalHeaderInfo);
This is for me, and for those who came across similar sweet issue. Hope this helps.

how about a complete working source code example?
ReplyDeleteThanks for your comment.
ReplyDeleteThis post contains the code that would go into the Form1.cs file. No other jingle bells associated. I did reformat the code here on this page you for, please see step 1 and step 2 above.
You may download FrmTest.cs file out of a working sample from following link: http://sites.google.com/site/kamranhk/FrmTest.cs
Let me know in case you would still want a complete .sln based solution files. Would be glad to help.
I have all this working, but now none of the callbacks from the webpage work. I had been using ie.ObjectForScripting = this;
ReplyDeleteBut that no longer works. I know it is because of IOleObject, just not sure how to solve it.
Joe, thanks for your comment.
ReplyDeleteIs your code COM Callable? Because for ObjectForScripting to work you should have a COMVisible attribute added and set to true. Something like following on the top of the class:
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
MSDN says:[http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx]
"Use this property to enable communication between a Web page hosted by the WebBrowser control and the application that contains the WebBrowser control. This property lets you integrate dynamic HTML (DHTML) code with your client application code. The object specified for this property is available to Web page script as the window.external object, which is a built-in DOM object provided for host access."-
The above MSDN reference has a sweet example which I'm sure would give you better understanding.
Let me know if you come across any issues; I'd glad to help.
Oddly enough when on the same domain as the secured resource (SharePoint) the form will log in two users (the user specified manually in the credentials and the user logged into the machine). SharePoint shows the user logged into the machine is logged on, but if you choose "Sign in as a different user" the user specified by the form application is signed in. I can't seemto figure out why this is happening. Any ideas?
ReplyDeleteThanks for your comment Jamin.
ReplyDeleteCan you be more specific as to what exactly are you trying to achieve?
If I understand you correctly, your Form and secured site is on the same domain, and therefore the Form is logging in two users at-the-same-time?
The form application(that is, WinForms) is "usually" unaware of the logged in user, unless otherwise is explicitly told to the application.
So whatever values(userid/pwd) are going to be set as credentials in the Form, whether you are retrieving the credentials of logged in user and passing it to the Form - or - you are providing manual credentials (using config file or something), shall be forwarded by Form to the secured site. Secured site shall always be unaware of the Form, it would always assume that a User has logged in.
The integrated authentication process is that, when a user logs on to the domain the credentials gets verified, against the active directory, and IsAuthenticated bit in the OS is set to true[http://msdn.microsoft.com/en-us/library/aa480475.aspx].
So when a secured site, which has Integrated Windows Authentication turned on, gets a connection request, it looks for that IsAuthenticated bit; and more precisely looks for it to be "true". If that bit is false, you will be provided with the popular network credentials pop window. And then would verify those credentials against some active directory.
Now in your case, you have both (Form and secured site) on the same domain.
Your SharePoint must be using the integrated windows authentication; so it only looks for the IsAuthenticated bit, and thats why it is showing the currently logged in user. In that case it would not require the Form to provide credentials explicitly.
For instance, when a user, for example User B, logs on to the domain successfully it becomes an Authenticated User having IsAuthenticated bit set to true. If User B opens the SharePoint page, it(the SharePoint) merely checks the IsAuthenticated bit, retrieves user credentials, the user name, and let the user log in.
While in the Forms case, the Form is running under Authenticated credentials, and when you pass on the different but valid credentials to the forms, they get authenticated as well.
Therefore it would work in both cases.
Let me know if dragged your question entirely to 180 degrees.
One more thing, just to add; In most cases we require Form to log-in on a secured site where "separate" domains are a concern; thats where we provide credentials explicitly. Or in cases where the domain is same but proxy requires a set of credentials, or for auditing reasons, etc.
So, in your case when you are on the same domain why would you require your application to log in explicitly?
Hi,KMan.
ReplyDeleteI have seen your comments which have been great help to others.
And I think you're so talented and I want you to solve my problem.
My problem is:
I use webbrowser control in c# vs2005
and I want to use private proxies which require username and password.
I have implemented use of normal proxies
But for private proxies , the dialog which require username and password is displayed when I try to navigate to a page.
I know username and password but I want to do authentication part programmatically
Plz help me.
Any suggestions will be great help to me.
Thanks.
Hello Khey, by 'private proxies' I assume you mean different proxy for different web requests.
ReplyDeleteThere is no property on the WebBrowser control that would let you set the Proxy credentials; I believe you will have to use the 'AdditionalHeader' parameter while you 'Navigate()' the url. So, here is how you would pass the proxy credentials in WebBrowser control:
--CODE--
Uri uri = new Uri("http://www.somewheresurl.com");
//Alternatively, you may use System.Text.UnicodeEncoding.UTF8.GetBytes()
string additionalHeaderInfo = "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("MyUsername" + ":" + "MyPassword")) + System.Environment.NewLine;
webBrowser1.Navigate(uri, null, null, additionalHeaderInfo);
--CODE_END--
Or if you want to the change the global proxy settings, you will require tweaking with registry settings; but this would change the proxy globally!
--CODE--
RegistryKey RegKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
RegKey.SetValue("ProxyServer", "server:ip");
RegKey.SetValue("ProxyEnable", 1);
--CODE_END--
If, at all, at any point in time you find yourself interested in digging deeper in header field definitions of HTTP protocol, this(http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) is a good read.
Let me know if this doesn't help.
Hi KMan,
ReplyDeleteThanks for the good post.
I'd like to use your solution in my console application.
My original idea is to create thumbnail from web browser at console application. It is working fine but it didn't work with Sharepoint pages. So I looked for the way and found your solution.
Your solution seems working fine. But the problem is I only get the blank image. As it is the console application, I don't have the form_load. So I put the things together in one module as the following.
private void Get_ScreenShot()
{
string oURL = "about:blank";
webBrowser.Navigate(oURL);
//Notify the WebBrowser object about the client site.
//The client site, informs an embedded object of its display location
object obj = webBrowser.ActiveXInstance;
IOleObject oc = obj as IOleObject;
oc.SetClientSite(this as IOleClientSite);
//End
webBrowser.Navigate(url);
.......
}
Do you have any idea so that this solution can work with console application?
Thanks and Regards,
Thant Zin
Thant, please see my response below:
ReplyDelete>But the problem is I only get the blank image
So I assume, you "do" get the pages but you do not get the images, right? Did you try loading a different website? CNN.com may be? To see if you are getting the images at all?
Just a thought, it could be that you are using, DrawToBitmap() to create thumbnails, which according to MSDN(http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser_members.aspx); "this method is not supported by this control".
So you may find a workaround here: (http://www.codeproject.com/Messages/2554561/Re-why-I-just-get-blank-image.aspx)
>It is working fine but it didn't work with Sharepoint pages.
Any web page is transparent to the WebBrowser control; Sharepoint usually requires authentication before rendering any page to the user, so that might be a reason in your case.
By looking directly are your requirements: "to create thumbnail from web browser"
I think this link is what you are after: http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx
Let me know if this doesn't help.
Hi KMan,
ReplyDeleteThanks for your prompt response.
The method I used is similar to the link you referred "http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx". But this one is more effective.
>So I assume, you "do" get the pages but you do not get the images, right? Did you try loading a different website? CNN.com may be? To see if you are getting the images at all?
When I try the different web site, I also get the same blank image. What I suspect is because of "about:blank" browsing. When I change it to some other web site and try again, I get the image. But for the bypassing we need it, right?
So, is there a way to put browsing about:blank to different module at console application and use again in screen shot module?
Thanks for your help.
Regards,
Thant Zin
Thant, the WebBrowser control would work anyway for any website;
ReplyDelete'about:blank' is precisely for if you are navigating to a secured(https) site. If you aren't then you may replace 'about:blank' with something interesting, or don't call it even.
Hi KMan,
ReplyDeleteI appreciate your help and your good post.
The blank image is because of me.
I have to put the following code in WebBrowser_DocumentCompleted Event Handler.
if (e.Url.AbsoluteUri.Equals("about:blank"))//same page
{ return; }
I just noticed that code in your program Today.
Thanks again.
Have a nice weekend.
Regards,
Thant Zin
Hi Kman,
ReplyDeleteThanks for your post. It is working fine in windows application with web browser control. I have custom requirement in outlook Add-in developement.
In my outlook addin there is no webbrowser control.I created new folder and set the shrepoint site URL as homepage URL for the folder. when we click on that folder it prompts credentionals window to check the authentication. I want to skip this authentication window and pass the credentionals programatically(like the webbrowser control). How can we do this? It is working with only webbrowser control?
I tried in outlook in the follwing way, but oc retunts as null and throws the exception.
IOleObject oc = outlookObj as IOleObject;
oc.SetClientSite(this as IOleClientSite);
Do you have any idea to avoid this credentionals window in outllok.
Thanks and Regards,
Kiran
Kiran you can try looking into intercepting the StsSync protocol that is used to enable Outlook or third party applications to sync SharePoint. Though I am not sure, just thinking out loud!
ReplyDeletehttp://msdn2.microsoft.com/en-us/library/ms868667.aspx.
Excellent job! I've been looking for this to integrate into a BHO. Is it compatible with both IE7 and IE?
ReplyDeleteCheers!
Hi KMan,
ReplyDeleteThanks for the article. I am using a windows form and have the code as you have specified here. Even though I have the call to "about:blank" preceding my actual call, but still my implementation of IAuthenticate.Authenticate is not being called. Any pointers would be really helpful.
Thanks
Jaitley
Hi KMan,
ReplyDeleteMe again.
We are getting blank page results sometimes when the Sharepoint webpage contaings IFRAME. Is there a way for me to overcome that?
Thanks and Regards,
Thant Zin
Welcome back Thant.
ReplyDeleteTry reload the iframe, from within the code:
document.getElementById([FrameID]).contentDocument.location.reload(true);
Or you can write a function in your aspx page:
function Refresh(frmId)
{ document.getElementById(frmId).contentDocument.location.reload(true);
}
and call it from your code:
browser.Document.InvokeScript("Refresh", new[] { "yourFrameID" });
Good morning,
ReplyDeleteHave been studying your code for a couple of days and finally got it to work. Thank you for sharing your knowledge. I have a lot of studying a head of me as I still do not wholly understand the code, nor could I recreate it from memory.
I am immensely appreciative of your expertise and generosity.
Take care,
Dave
@Anon: I am glad I was able to help. (0:
ReplyDeleteHello KMan,
ReplyDeleteI'd like to ask is it possible to use your solution in an asp.net application to redirect from a website to another website have the Basic authentication popup and escape it.... I'm really looking for days to find a solution for that problem.
if yes, is there's any recommendation on it's implementation at asp.net C# web application.
Many Thanks
I follow your instructions copy/paste the code but no luck. Do you have a full solution I could download?
ReplyDeleteI hope you are not making an april-fool out of it? (0:
ReplyDeleteCan you elaborate more on "no luck"? What is the error that you get?
People have used this code successfully from the same file. Nevertheless, I will upload the .SLN for you, gimme some time.
I have VS 2010
ReplyDeleteI create the Windows Form App
I get the file Form1.cs
I open the source and paste your code.
For starters the System.WEb reference is missing
Middleware.DataAccess had to be commented out
After building the first time I get all sorts 78 errors.
These are the first 5
Error 1 The namespace 'Somenamespace' already contains a definition for 'IOleObject' c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 30 22 PWFA
Error 2 The namespace 'Somenamespace' already contains a definition for 'IOleClientSite' c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 61 22 PWFA
Error 3 The namespace 'Somenamespace' already contains a definition for 'IServiceProvider' c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 76 22 PWFA
Error 4 The namespace 'Somenamespace' already contains a definition for 'IAuthenticate' c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 88 22 PWFA
Error 5 The type 'Somenamespace.FrmTest' already contains a definition for 'QueryCommands' c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 110 22 PWFA
and others more:
ReplyDeleteError 2 The name 'InitializeComponent' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 137 13 PWFA
Error 3 The name 'theBrowser' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 142 13 PWFA
Error 4 The name 'webBrowser1_Navigating' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 142 75 PWFA
Error 5 The name 'theBrowser' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 143 13 PWFA
Error 6 The name 'OnShow' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 150 44 PWFA
Error 7 The name 'OnHide' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 151 44 PWFA
Error 8 The name 'OnExit' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 152 44 PWFA
Error 9 The name 'OnTooltipLogging' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 153 59 PWFA
Error 10 The name 'Resources' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 160 38 PWFA
Error 11 The name 'CHelper' does not exist in the current context c:\users\rborjes\documents\visual studio 2010\Projects\PWFA\PWFA\Form1.Designer.cs 170 13 PWFA
Hi KMan,
ReplyDeleteCurrently, I put this check in WebBrowser_DocumentCompleted event,
if (e.Url.AbsolutePath == webBrowser.Url.AbsolutePath)
{
//Real Document Complete
}
else
{
return;
}
And I use IHTMLElementRender2 (from http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx?msg=2053785).
After that, it is working fine.
Anyway, Thanks for your help.
Regards,
Thant Zin
@Eduardo7095: Thanks for your feedback, much appreciated. Please see the updated post. You can download the solution files from: http://sites.google.com/site/kamranhk/Src_TestWebBrowserControl.zip
ReplyDeleteLet me know how it goes.
Hi KMan,
ReplyDeleteCurrently, I put this check in WebBrowser_DocumentCompleted event,
if (e.Url.AbsolutePath == webBrowser.Url.AbsolutePath)
{
//Real Document Complete
}
else
{
return;
}
And I use IHTMLElementRender2 (from http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx?msg=2053785).
After that, it is working fine.
Anyway, Thanks for your help.
Regards,
Thant Zin
Hi Kman,
ReplyDeleteJust wanted to say thanks for providing this great information - this solution worked perfect for me to auto-log into a https site - One thing to watch out for is if you put in invalid credentials it'll load a blank page with no errors displayed! (This is because it was automatically done through the code) So if you are getting a blank page be sure to double check your credentials.
Thanks again!
Your post helped get unstuck with a similar problem. Thank you! :)
ReplyDelete