如何使用C#检测IIS版本? [英] How to detect IIS version using C#?

查看:357
本文介绍了如何使用C#检测IIS版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#检测IIS版本?

How to detect IIS version using C#?

更新:
我从一个winapp(实际上该方案正在制定要检查安装IIS版本调用相应的API的自定义安装程序)

Update: I meant from a winapp (actually the scenario is developing a custom installer that wants to check the version of the installed IIS to call the appropriate api's)

推荐答案

您可以从 SERVER_SOFTWARE 变量此信息。它会返回以下内容:

You can get this information from the SERVER_SOFTWARE variable. It will return the following:

微软IIS / 5.0(Windows 2000)的

微软-IIS / 5.1(Windows XP中)

微软-IIS / 6.0(Windows 2003 Server的)

等。

如果您正在使用ASP.NET,您可以通过

If you're using ASP.NET, you can get this string via

Request.ServerVariables["SERVER_SOFTWARE"];

编辑:看来你将要查询注册表来获取这些信息。看看此页面怎么看。

这篇关于如何使用C#检测IIS版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆