Thursday, December 1, 2011

How to detect browser and Operating System (OS) with ASP.NET


You can use "Request.UserAgent" if you're programming ASP.NET, otherwise it quite simple to get through other programming languages or the client script by Javascript.
Back to the returns of "Request.UserAgent" which is for an example
"Mozilla/5.0 (Windows; U; Windows NT 5.1; da; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13"..
Some of these information's returns which browser system, browser version, operating system and version you are using, which is very usefully, when you're trying to determine the user operating system. If you knows the user operating system (You can request it in ASP.NET by "Request.Browser.Platform", and wants to know know the specific version like 2000, XP and Vista.
You can check if the OS version number is in the User agent. If you're looking in the example I did post above this text, you can see a Windows NT number, that's the number who indicate the specific Windows version. "Windows NT 5.1" means that this user is using Windows XP.