WebBrowser1.Navigate using IE9

dzarelli

Member
Joined
Jun 4, 2012
Messages
7
Programming Experience
1-3
Hey guys... I'm new so please go easy on me. I've had a VB.net application using C# that I created in Visuil Stuido 2010 in use for several months now.

Up until today, it worked fine. The application is designed to pull up various webpages in webbrowser windows within the VB application. Now, I've read that these WebBrowser1.Navigate windows open using some sort of IE7 compatibility mode. The main page that the application loads on startup was updated today and now requires IE9+ (or Chrome or Firefox) in order to even display the page. Now, I've looked high and low for a solution to make my application open webbrowser.navigate windows with IE9, but the solutions I've found have all been HTML based or registry changes (none of which I have been able to make work).

Registry - [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"contoso.exe"=dword:00002328 (in may case, I changed "contoso.exe" to "BF3tools.exe", as that is the application in question, but it made no difference).

This registry change seems to do nothing from the perspective of the application, and the destination page in question still fails to load properly (It simply shows the error "you must update your browser to view this page").

HTML fix? - <meta http-equiv="X-UA-Compatible" content="IE=9">

Now, if I'm being honest here, I'm not sure how to make this code work within a vb.net application, where I would put it, or if that can even be done (I'm a newb).

The application in question is posted here: BF3Tools by Xer0daze

The page I'm trying to call within the application is Battlelog / Sign in and it works just fine when using a stand-alone IE9 browser (as well as with Chrome, or Firefox).<BR><BR>I'm starting to get a lot of emails from users asking for help fixing this issue, but as of right now, I really have no idea. Any assistance is appreciated. Thanks guys!
 
While the page you linked to displays equal here in IE9 and WebBrowser control, you're right the UserAgent string by default specifies MSIE 7.0 standards mode. You can change that by adding a registry value for FEATURE_BROWSER_EMULATION, see Internet Feature Controls (B..C) (Internet Explorer)
And the registry path is slightly different for 64bit systems (Wow6432Node\Microsoft\...).
User would need to have IE9 installed also, if you need to programmatically check this you can read the WebBrowser.Version property.
Also notice if you run in VS debugger the exe is f.ex: BF3tools.vshost.exe
You can see the effect on useragent string of various settings by displaying a page like this: Whats My User Agent?
I've had a VB.net application using C# that I created in Visuil Stuido 2010
err...
 
Thanks for that! That works. This problem was simple actually, I was making the change to the 32bit registry path on a 64bit system. When I made the change at the correct location it resolved the problem. The only issue with this is that now I have to have all my end-users make the same registry change. Being new to asp.net, is there a way to make the application installer create/update these registry keys? Currently I've baked .reg files into the application via a menu option, but I'd rather have the application perform a key check and create the keys if necessary. I'm just not sure how to accomplish that. Any ideas? Thanks again for your assistance JohnH, it is appreciated!
 
You can configure registry keys with setup project, not with ClickOnce. Registry Settings Management in Deployment

Thanks man...​I went ahead and created a separate setup project as it says to do here. Now I've got everything called out in that setup project, but when I compile and publish the app, then run the install on it, it's not creating the registry entries on the client machine. Is there something special I need to do within the code or when I publish/compile to call the setup project (currently called 'setup1')?

eh, what?

Sorry - meant to say vb - I'm basically new at all this stuff...

I also wanted to just thank you guys for the help... I've had trouble finding reliable resources for this project and you guys are life-savers (especially you John), so thanks again.
 
No additional action, installer adds it when you install the .msi.
 
Okay, well for some reason it didn't add those registry values when I compiled/published it. Not sure why... the new file(s) are published if you can check it out. I'm not sure why this isn't working... I'm SO CLOSE!
 
the new file(s) are published if you can check it out
You mean "The application in question is posted here" link? Not that I would install it anyway, but that is a ClickOnce publish, and not the msi installer that is generated when you build a Setup Project.
 
One last question. It appears that the browser (on 64-bit machines at least) is pulling up the 64-bit browser to dispaly pages within the application. I get an error when trying to launch an application from a web page called from my app that says I need to use a 32 bit browser. Is there a way to force the app to display using 32-bit browser? Thanks
 
One last question. It appears that the browser (on 64-bit machines at least) is pulling up the 64-bit browser to dispaly pages within the application. I get an error when trying to launch an application from a web page called from my app that says I need to use a 32 bit browser. Is there a way to force the app to display using 32-bit browser? Thanks
If your app is compiled for AnyCpu platform, the app runs as 64bit app on 64bit system, and WebBrowser control uses the 64bit IE engine also. If you compile your app for the x86 platform it runs as 32bit even on 64bit system, and WebBrowser control will then also use the 32bit IE engine. This can be configured in Configuration Manager.
 
Thanks. I compiled as x86 but the user agent still shows x64. I haven't made any progress on this in a while and I'm thinking of moving on to something else. I'd sure like to know how come, even when I compile at 32-bit, it always called webbrowser1 is x64. Anyway, thank you guys for the help.
 
That sounds strange to me, and contradicts what I've read about this topic elsewhere on the web. I have no way of testing this myself however. Sure it doesn't say 'Wow64' ?
Also sure you used the correct compiled version of your app ? Sometimes when I've changed profiles I've gotten a separate x86 subfolder for those compiles.
 

Latest posts

Back
Top