How to obtain the name of the operating system used by the client with ASP.Net MVC 4.5?


I'm trying to get the name of the operating system that the client uses when he's using my web application, so far I've only been able to get the name of the operating system where the application is running.

 ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem");
        foreach (ManagementObject os in searcher.Get())
            result = os["Caption"].ToString();

I appreciate your answers.

asked by Pablo Tolentino 22.11.2016 в 20:50

2 answers


You can try this:

HttpBrowserCapabilities Navegador = Request.Browser;
string SistemaOperativo = Navegador.Platform;

Note: HttpBrowserCapabilities belongs to the spaces name of System.Web

Another possibility is to use Request.UserAgent . Something like this:

string SistemaOperativo = Request.UserAgent

As @zevane commented, in the case of this last alternative, it is necessary to work the resulting chain, which is of the type


User Agent :: Mozilla / 5.0 (compatible; MSIE 6.0b; Windows NT 6.1; .NET CLR 1.0.2914)

answered by 22.11.2016 / 21:18

You could try

System.OperatingSystem osInfo = System.Environment.OSVersion;   
answered by 22.11.2016 в 22:23