tag:blogger.com,1999:blog-4252428322984442391.post8524252118306845612..comments2023-05-18T05:57:45.463-07:00Comments on withoutbugs.com: WebBrowser Control: Bypass integrated authenticationUnknownnoreply@blogger.comBlogger31125tag:blogger.com,1999:blog-4252428322984442391.post-2256785026174310602012-01-09T06:10:01.491-08:002012-01-09T06:10:01.491-08:00Your post helped get unstuck with a similar proble...Your post helped get unstuck with a similar problem. Thank you! :)Eric Hudonhttp://erichudon.canoreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-58253553664875307232012-01-04T10:51:18.077-08:002012-01-04T10:51:18.077-08:00Hi Kman,
Just wanted to say thanks for providing ...Hi Kman,<br /><br />Just 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. <br /><br />Thanks again!Brenthttps://www.blogger.com/profile/03717599220102039838noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-4983475338888592372011-04-07T02:32:39.899-07:002011-04-07T02:32:39.899-07:00Hi KMan,
Currently, I put this check in WebBrowse...Hi KMan,<br /><br />Currently, I put this check in WebBrowser_DocumentCompleted event,<br /><br /> if (e.Url.AbsolutePath == webBrowser.Url.AbsolutePath)<br /> {<br /> //Real Document Complete<br /> }<br /> else<br /> {<br /> return;<br /> }<br /><br />And I use IHTMLElementRender2 (from http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx?msg=2053785). <br />After that, it is working fine.<br /><br />Anyway, Thanks for your help.<br /><br />Regards,<br />Thant ZinUnknownhttps://www.blogger.com/profile/08002100680312044374noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-27353465799032638832011-04-07T00:11:53.651-07:002011-04-07T00:11:53.651-07:00@Eduardo7095: Thanks for your feedback, much appre...@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<br /><br />Let me know how it goes.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-19076904280611614182011-04-06T20:09:50.955-07:002011-04-06T20:09:50.955-07:00Hi KMan,
Currently, I put this check in WebBrowser...Hi KMan,<br />Currently, I put this check in WebBrowser_DocumentCompleted event,<br /><br /> if (e.Url.AbsolutePath == webBrowser.Url.AbsolutePath)<br /> {<br /> //Real Document Complete<br /> }<br /> else<br /> {<br /> return;<br /> }<br /><br />And I use IHTMLElementRender2 (from http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx?msg=2053785). <br />After that, it is working fine.<br /><br />Anyway, Thanks for your help.<br /><br />Regards,<br />Thant ZinUnknownhttps://www.blogger.com/profile/08002100680312044374noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-74629104325361092042011-04-03T00:20:38.892-07:002011-04-03T00:20:38.892-07:00and others more:
Error 2 The name 'InitializeC...and others more:<br />Error 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<br />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<br />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<br />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<br />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<br />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<br />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<br />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<br />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<br />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 PWFAEduardo7095https://www.blogger.com/profile/13919034268574658613noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-9557705969108326442011-04-03T00:16:47.334-07:002011-04-03T00:16:47.334-07:00I have VS 2010
I create the Windows Form App
I get...I have VS 2010<br />I create the Windows Form App<br />I get the file Form1.cs<br />I open the source and paste your code.<br />For starters the System.WEb reference is missing<br />Middleware.DataAccess had to be commented out<br />After building the first time I get all sorts 78 errors.<br />These are the first 5<br /><br />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<br />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<br />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<br />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<br />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 PWFAEduardo7095https://www.blogger.com/profile/13919034268574658613noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-23591678046390694852011-04-02T04:36:00.856-07:002011-04-02T04:36:00.856-07:00I hope you are not making an april-fool out of it?...I hope you are not making an april-fool out of it? (0:<br /><br />Can you elaborate more on "no luck"? What is the error that you get?<br /><br />People have used this code successfully from the same file. Nevertheless, I will upload the .SLN for you, gimme some time.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-75495544556707959922011-04-01T18:54:47.580-07:002011-04-01T18:54:47.580-07:00I follow your instructions copy/paste the code but...I follow your instructions copy/paste the code but no luck. Do you have a full solution I could download?Eduardo7095https://www.blogger.com/profile/13919034268574658613noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-32550224451684840892011-03-29T11:16:14.662-07:002011-03-29T11:16:14.662-07:00Hello KMan,
I'd like to ask is it possible to...Hello KMan,<br /><br />I'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.<br /><br />if yes, is there's any recommendation on it's implementation at asp.net C# web application.<br /><br />Many ThanksXenon2008noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-47723132936637132932011-03-08T21:46:09.485-08:002011-03-08T21:46:09.485-08:00@Anon: I am glad I was able to help. (0:@Anon: I am glad I was able to help. (0:Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-88802687270746820432011-03-08T05:15:36.271-08:002011-03-08T05:15:36.271-08:00Good morning,
Have been studying your code for a ...Good morning,<br /><br />Have 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.<br /><br />I am immensely appreciative of your expertise and generosity.<br /><br />Take care,<br />DaveAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-58056981778938069502011-03-05T05:31:12.464-08:002011-03-05T05:31:12.464-08:00Welcome back Thant.
Try reload the iframe, from w...Welcome back Thant.<br /><br />Try reload the iframe, from within the code:<br /><br />document.getElementById([FrameID]).contentDocument.location.reload(true);<br /><br />Or you can write a function in your aspx page:<br /><br />function Refresh(frmId) <br />{ document.getElementById(frmId).contentDocument.location.reload(true);<br />}<br /><br />and call it from your code:<br /><br />browser.Document.InvokeScript("Refresh", new[] { "yourFrameID" });Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-68829449061480739662011-03-02T19:40:19.553-08:002011-03-02T19:40:19.553-08:00Hi KMan,
Me again.
We are getting blank page res...Hi KMan,<br /><br />Me again.<br /><br />We are getting blank page results sometimes when the Sharepoint webpage contaings IFRAME. Is there a way for me to overcome that?<br /><br /><br />Thanks and Regards,<br />Thant ZinThant Zin (UCSM)noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-14360228548325407162010-12-13T04:54:08.203-08:002010-12-13T04:54:08.203-08:00Hi KMan,
Thanks for the article. I am using a win...Hi KMan,<br /><br />Thanks 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. <br /><br />Thanks<br />JaitleyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-22067496800703464712010-07-23T09:00:10.481-07:002010-07-23T09:00:10.481-07:00Excellent job! I've been looking for this to i...Excellent job! I've been looking for this to integrate into a BHO. Is it compatible with both IE7 and IE?<br /><br />Cheers!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-14133369384521891722010-06-17T01:12:30.120-07:002010-06-17T01:12:30.120-07:00Kiran you can try looking into intercepting the St...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!<br /><br />http://msdn2.microsoft.com/en-us/library/ms868667.aspx.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-8330126786420023872010-06-15T00:04:59.584-07:002010-06-15T00:04:59.584-07:00Hi Kman,
Thanks for your post. It is working fine...Hi Kman,<br /><br />Thanks for your post. It is working fine in windows application with web browser control. I have custom requirement in outlook Add-in developement. <br />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?<br /><br />I tried in outlook in the follwing way, but oc retunts as null and throws the exception.<br /><br /> IOleObject oc = outlookObj as IOleObject;<br /> oc.SetClientSite(this as IOleClientSite); <br /><br />Do you have any idea to avoid this credentionals window in outllok.<br /><br />Thanks and Regards,<br />KiranUnknownhttps://www.blogger.com/profile/11264215213651330954noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-63838142315418799192010-04-29T20:30:53.847-07:002010-04-29T20:30:53.847-07:00Hi KMan,
I appreciate your help and your good pos...Hi KMan,<br /><br />I appreciate your help and your good post.<br /><br />The blank image is because of me.<br /><br />I have to put the following code in WebBrowser_DocumentCompleted Event Handler.<br /><br /> if (e.Url.AbsoluteUri.Equals("about:blank"))//same page<br /> { return; }<br /><br />I just noticed that code in your program Today.<br /><br />Thanks again.<br /><br />Have a nice weekend.<br /><br />Regards,<br />Thant ZinUnknownhttps://www.blogger.com/profile/08002100680312044374noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-33232324176509571192010-04-28T09:42:01.883-07:002010-04-28T09:42:01.883-07:00Thant, the WebBrowser control would work anyway fo...Thant, the WebBrowser control would work anyway for any website; <br /><br />'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.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-68600114215369218672010-04-28T02:48:44.631-07:002010-04-28T02:48:44.631-07:00Hi KMan,
Thanks for your prompt response.
The me...Hi KMan,<br /><br />Thanks for your prompt response.<br /><br />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.<br /><br />>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?<br /><br />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?<br /><br />So, is there a way to put browsing about:blank to different module at console application and use again in screen shot module?<br /><br />Thanks for your help.<br /><br />Regards,<br />Thant ZinUnknownhttps://www.blogger.com/profile/08002100680312044374noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-73245199031144677402010-04-27T01:14:11.882-07:002010-04-27T01:14:11.882-07:00Thant, please see my response below:
>But the ...Thant, please see my response below:<br /><br />>But the problem is I only get the blank image<br /><br />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?<br /><br />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".<br /><br />So you may find a workaround here: (http://www.codeproject.com/Messages/2554561/Re-why-I-just-get-blank-image.aspx)<br /><br />>It is working fine but it didn't work with Sharepoint pages.<br /><br />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.<br /><br />By looking directly are your requirements: "to create thumbnail from web browser"<br /><br />I think this link is what you are after: http://www.codeproject.com/KB/cs/Website_Thumbnails_in_C.aspx<br /><br />Let me know if this doesn't help.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-59515203071234772292010-04-26T19:58:08.752-07:002010-04-26T19:58:08.752-07:00Hi KMan,
Thanks for the good post.
I'd like ...Hi KMan,<br /><br />Thanks for the good post.<br /><br />I'd like to use your solution in my console application.<br />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.<br /><br />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.<br /><br /> private void Get_ScreenShot()<br />{<br />string oURL = "about:blank"; <br /> webBrowser.Navigate(oURL);<br /><br /> //Notify the WebBrowser object about the client site. <br /> //The client site, informs an embedded object of its display location <br /> object obj = webBrowser.ActiveXInstance;<br /> IOleObject oc = obj as IOleObject;<br /> oc.SetClientSite(this as IOleClientSite);<br /> //End<br /> <br /> webBrowser.Navigate(url);<br />.......<br />}<br /><br />Do you have any idea so that this solution can work with console application?<br /><br />Thanks and Regards,<br />Thant ZinUnknownhttps://www.blogger.com/profile/08002100680312044374noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-26879435130522883102010-03-23T04:19:24.652-07:002010-03-23T04:19:24.652-07:00Hello Khey, by 'private proxies' I assume ...Hello Khey, by 'private proxies' I assume you mean different proxy for different web requests.<br /><br />There 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: <br /><br />--CODE--<br />Uri uri = new Uri("http://www.somewheresurl.com");<br /><br />//Alternatively, you may use System.Text.UnicodeEncoding.UTF8.GetBytes()<br />string additionalHeaderInfo = "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("MyUsername" + ":" + "MyPassword")) + System.Environment.NewLine;<br /><br />webBrowser1.Navigate(uri, null, null, additionalHeaderInfo);<br />--CODE_END--<br /><br />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!<br />--CODE--<br />RegistryKey RegKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);<br /><br />RegKey.SetValue("ProxyServer", "server:ip");<br />RegKey.SetValue("ProxyEnable", 1);<br />--CODE_END--<br />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.<br /><br />Let me know if this doesn't help.Chief Editorhttps://www.blogger.com/profile/17678121382231285858noreply@blogger.comtag:blogger.com,1999:blog-4252428322984442391.post-14702322333069176582010-03-22T06:26:18.238-07:002010-03-22T06:26:18.238-07:00Hi,KMan.
I have seen your comments which have been...Hi,KMan.<br />I have seen your comments which have been great help to others.<br />And I think you're so talented and I want you to solve my problem.<br />My problem is:<br /><br />I use webbrowser control in c# vs2005<br />and I want to use private proxies which require username and password.<br />I have implemented use of normal proxies<br />But for private proxies , the dialog which require username and password is displayed when I try to navigate to a page.<br />I know username and password but I want to do authentication part programmatically<br />Plz help me.<br />Any suggestions will be great help to me.<br /><br />Thanks.Unknownhttps://www.blogger.com/profile/11465539694511233055noreply@blogger.com