How to Find IIS Version With ASP.NET Code?
Although .Net Framework in general gives you uniform run-time environment on different operating systems, some things works differently. For example, if you try to implement URL rewriting or ASP.NET routing, code will return just an error 404 - Page Not Found on earlier versions of IIS.
To find out which version of IIS hosts your web application, you can use SERVER_SOFTWARE from Request.ServerVariables collection, with code like this:
[ C# ]
Response.Write(Request.ServerVariables["SERVER_SOFTWARE"]);
[ VB.NET ]
Response.Write(Request.ServerVariables("SERVER_SOFTWARE"))
This code line will return output with server name and version, for example:
Microsoft-IIS/6.0
Related articles:
1. How To Get Server Computer Name?
Copyright © 2002-2008 Bean Software. All rights reserved.