views:

984

answers:

3


How can I know under which IIS version my web application is running in development server?
As .Net framework 2.0,3.0,3.5 have support built in IIS....
Thanks

+3  A: 

@AnthonyWJones "So the question becomes, How does an ASP.NET application determine what operating system it is running on?"

You can use System.Environment.OSVersion

DoctaJonez
+4  A: 

To get the IIS version of the webserver you can use the SERVER_SOFTWARE server variable.

Request.ServerVariables["SERVER_SOFTWARE"];

It will return something like as follows:

Microsoft-IIS/5.0 (Windows 2000)

Microsoft-IIS/5.1 (Windows XP)

Microsoft-IIS/6.0 (Windows 2003 Server)

You can find a full reference of server variables here.

DoctaJonez
this return empty string in development server....
Muhammad Akhtar
+3  A: 

This is available directly from the SERVER_SOFTWARE server variable:

HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"];

which is a string like "Microsoft-IIS/7.0".

NB, the string is empty for the ASP.NET development server ("Casini").

Richard
but I need to know in development server, how can I ? thanks
Muhammad Akhtar
Using the development server => not using IIS, so the question does not apply.
Richard