Friday, August 1, 2014

Get operating system name from HttpRequest

I was creating a HttpModule in SharePoint to track the request related data such as browser name and client platform. If you are tracking request related data then you must be familiar with System.Web.HttpBrowserCapabilities class. HttpBrowserCapabilities class enables the server to gather information on the capabilities of the browser that is running on the client. I was using HttpCapabilitiesBase.Platform Property to get the client operating system name. But for Windows platform it was returning "WinNt" instead of actual operating system name. After doing some research I noticed that Request.UserAgent returns operating system information along with operating system version number. 

Here is my code to get the Operating System name from Request.UserAgent

If you find more combinations please add it to comments section.

No comments:

Post a Comment