确定站点的ASP.NET版本 [英] Identify the ASP.NET version of a site
问题描述
我调试了一个网站。我需要识别正在运行的站点的.NET和ASP.NET版本(在本地IIS上)。
I debug a site. I need to identify the .NET and ASP.NET version of the running site (on a local IIS).
当我遇到.NET错误时,页面是显示如下:
When I have an .NET Error, the a page is displayed, like this:
'/'应用程序中的服务器错误。
配置错误
描述:处理服务所需的
配置文件时出错这个请求。请查看下面的
特定错误详细信息,并相应地修改配置文件
。
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
分析器错误消息:无法识别的属性'requestValidationMode'。
请注意,属性名称区分大小写。
Parser Error Message: Unrecognized attribute 'requestValidationMode'. Note that attribute names are case-sensitive.
来源错误:
第120行:行121:行
122:行123:行
124:
Line 120: Line 121: Line 122: Line 123: Line 124:
源文件:C:\ mysite \opt\root \ web.config行:122
Source File: C:\mysite\opt\root\web.config Line: 122
版本信息: Microsoft .NET Framework版本: 4.0.30319;
ASP.NET版本: 4.6.1038.0
Version Information: Microsoft .NET Framework Version: 4.0.30319; ASP.NET Version: 4.6.1038.0
有没有办法以错误消息以外的方式获取该数据,以便能够根据需要识别该版本?
Is there a way to obtain that data in other way than a error message, to be able to identify that versions at demand?
我想强调 .NET 和 ASP.NET 不同,我需要它们。
I would like to stress that .NET and ASP.NET are different, and I need both of them.
PS。 我希望,如果可能的话,不必修改代码,而是通过IIS ...
PS. I would prefer, if possible do not have to modify the code, but rather via IIS...
推荐答案
您可以尝试之一下面这样
You can try either of this below
typeof(Page).Assembly.GetName().Version; //ASP.NET Version
这样就可以运行 ASP.NET
版本,在我的情况下 4.0.0.0
。如果展开参考
文件夹 - >查找 System.Web
dll - >右键单击,可以找到相同的信息选择属性 - >检查版本
信息。
This gives your running ASP.NET
version which in my case 4.0.0.0
. You can find the same information if you expand your Reference
folder -> find System.Web
dll -> right click and choose properties -> check the Version
information.
System.Environment.Version.ToString(); //Framework Version
这给出了CLR的版本信息。
This gives the version information of the CLR.
这篇关于确定站点的ASP.NET版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!