How to get name of Platform or operating system of client machine using asp.net ?

Below code is give the name of platform (Operating System) which is use by client.

//////////////////////////////////////// CODE ////////////////////////////////////////


    protected void GetPlatform()
    {

        HttpBrowserCapabilities bc = HttpContext.Current.Request.Browser;
        String Platform = bc.Platform;
        String pt = "";

        if (Request.UserAgent.IndexOf("Windows NT 5.1") > 0)
        {
            //xp
             pt = "win XPath";
        }
        else if (Request.UserAgent.IndexOf("Windows NT 6.0") > 0)
        {
            //VISTA
             pt = "win vista";
        }
        else if (Request.UserAgent.IndexOf("Windows NT 6.1") > 0)
        {
            //7
             pt = "win 7";
        }



////////////////////////////////////////////////////////////////////////////////////////

now you can print the string pt which print the name of browser.


--
/\/ir@\/  <(.'.)>

Comments

Popular posts from this blog

How to use serial.write() in Arduino.

How to make and use web service in Microsoft Dynamics Navision.

How to Generate random rows in dataset using c#.net