We help IT Professionals succeed at work.

How to get the browser version with vb.net 2003

gosonic
gosonic asked
on
Medium Priority
450 Views
Last Modified: 2010-05-18
vb.net 2003 (windows forms)

I am using  
  IEs As New SHDocVw.ShellWindows
  IE As SHDocVw.InternetExplorer

How do I determine which version of IE is being used here?  With the new IE7 beta being released it is important that I know if the user has upgraded.  

Thanks


Comment
Watch Question

Commented:
hi

look this code

http://support.microsoft.com/default.aspx?scid=kb;en-us;311281

 i think thats help you

Raj

Commented:
Dear gosonic,

Its very simple to write a code for getting browser information. All you need to do is using the HttpBrowserCapabilities class provided in .NET framework.

Following is the code sample.

Dim bc as HttpBrowserCapabilities
bc = Request.Browser
Response.Write("Type = " + bc.Type + "<br>");
Response.Write("Name = " + bc.Browser + "<br>");
Response.Write("Version = " + bc.Version + "<br>");

Let me know if you face any problems or if you require further information.

Regards,
Me
...well, since you're obviously doing this locally, my vote would be to get the installed version of ie from the registry.  However, i found this example that also explains the use of shdocvw.dll (which is still valid for ie 6 versions).  The example is in c, but it should give you enough to go in in vb.net.  Let me know, however, if the link doesn't provide enough info and i'll work it out for you.  : )

http://www.codeproject.com/shell/detectie.asp

wil

Author

Commented:
Headspace,

Yes I am doing it locally and I think your approach will work but I do need assistance in doing in VB.net I don't have any experience in c and don't know how to go about reading those vaules in VB.net - I will appreciate your help on this.
Thanks
ok...I'll go with the registry option, since it's super easy to do:

'add the Microsoft.Win32 namespace:
Imports Microsoft.Win32

'and within the appropriate sub:
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Internet Explorer", False)
Dim val as String = regKey.GetValue("Version")
regKey.Close()
'do something with val here

IE 5 and up also provide a 'build' value in the registry, which may or may not be important to your application.  I'm assuming that you likely won't be dealing with any versions older than 5 (since this is a .net app).  If you'd like an example using the shdocvw.dll, just let me know.

wil

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
This is good thank you.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.