How can i find what version of browser a user is using and ask him to upgrade it
You can read the HTTP_USER_AGENT from the Request.ServerVariables
On the server-side code: Request.Browser returns a HttpBrowserCapabilities instance with all the information you're looking for.
http://msdn.microsoft.com/en-us/library/system.web.httpbrowsercapabilities.aspx
On the client script side (javascript):
http://www.quirksmode.org/js/detect.html
Further to @Nick's comment, the following MSDN post:
http://msdn.microsoft.com/en-us/library/x3k2ssx2.aspx
states:
Browser capabilities indicate whether the browser type in general supports features such as JavaScript, not whether an individual instance of the browser has these features enabled or disabled.
I think version and type of the browser will tend to be fairly consistent.
You can perform feature detection using jQuery, like this:
if (!jQuery.support.opacity)
//Waah waah waah...
You can also check the browser version using jQuery, like this:
if (!jQuery.browser.msie && jQuery.browser.version === 6)
//Waah waah waah...
However, it should be avoided where possible.
If you are already using a javascript library like jQuery or mootools, you also have those tools at your disposal.
jQuery:
if( $.browser.msie ) {
// do something
}
mootools:
if (Browser.Engine.trident4) {
// ie6
}
keep in mind this is usually the wrong thing to rely on. Even the jQuery documentation has a warning that recommends feature detection instead of browser detection.
If it's only about Internet Explorer, you can use conditional comments:
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
More info at http://www.quirksmode.org/css/condcom.html