Determine OS using the Environment.OSVersion object - C#
<p>What is the best to determine the Microsoft OS that is hosting your ASP.NET application using the <code>System.Environment.OSVersion</code> namespace  </p>

<p>I need an example for Windows XP, Windows Server 2003 and Windows Vista</p>

<p>Here is what I am trying to accomplish using pseudocode</p>

<pre><code>switch(/* Condition for determining OS */)
{
    case "WindowsXP":
        //Do Windows XP stuff
        break;
    case "Windows Server 2003":
        //Do Windows Server 2003 stuff
        break;
    case "Windows Vista":
        //Do Windows Vista stuff
        break;
}
</code></pre>
