Which UserAgent is reported using the WebBrowser control?

It's just interesting what type of browser VB.NET reads when it visits a web page. For example, my website displays a breakdown of all browsers that have accessed my website.

+6
winforms user-agent webbrowser-control
source share
1 answer

You do not attach much importance to your question, but I assume that you are talking about the User Agent line that is dispatched when you use the WebBrowser control built into the .NET Framework.

Since this control simply uses Internet Explorer to render the page, you will see the User Agent line very similar to what you would find if you visited the page using IE on the same computer. The IE line generally declares itself to be Mozilla/4.0 compatible , but also provides a specific version of MSIE and lists the current version of Windows.

For example, when working under the 64-bit version of Windows Server 2008 R2 with version 4.0 of the .NET Framework, I define it as follows when I view pages using the WebBrowser :

Mozilla / 4.0 (compatible MSIE 7.0, Windows NT 6.1)

In contrast, Internet Explorer on the same computer displays this as a User Agent string:

Mozilla / 4.0 (compatible MSIE 8.0, Windows NT 6.1)

The only difference is that the .NET WebBrowser control WebBrowser itself as Internet Explorer version 7.0 ( MSIE 7.0 ) instead of version 8.0 installed on the computer. This is because the control uses the IE 7 rendering engine, not the one in IE 8, for compatibility reasons. If you want, you can change this by editing the registry value.

To start the WebBrowser in IE8 standard mode, use the following new value in the registry:

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE) \ Software \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BROWSER_EMULATION] "MyApplication.exe" = dword 8000 (Hex: 0x1F40)

To start IE7 in standard mode, use the following registry value:

[(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE) \ Software \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BROWSER_EMULATION] "MyApplication.exe" = dword 7000 (Hex: 0x1B58)

+13
source share

All Articles