I assume you're talking about ASP.Net, even though you failed to add the tag to your question.
For the client, parse the string you get back from this property:
Request.UserAgent
For the server itself, try this Codeproject article (it ain't hard to do, but the article explains some stuff):
Easily Get and Compare OS Version Information[
^]
lastly, learn to use Google. This question is EASILY answered with a simple google search.