Detect ASP.NET version from output HTML?
Ok, this is probably a trivial thing to know - hence the trivia tag! - but does anyone know of any difference in final output that would give away the version of the runtime that was used?
开发者_Go百科In other words, if you visit a website and you know it's generated via ASP.NET, are there any telltale things about the markup that would give away whether the site is running against 2.0 or 3.5?
No. The HTTP headers are configurable by admins, so they are unreliable. For instance stackoverflow.com says:
Server: Microsoft-IIS/7.5
MSN.com says:
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
and 37signals.com says:
X-Powered-By: PHP/5.3.0
And anyone can make any php site respond that is powered by ASP.Net 3.5 or claim that is a perl script when in fact is a ASP site. At the end of they day, HTTP is just text and all the headers are configurable by someone knowledgeable, and they mean little to nothing from a trust perspective.
There is nothing guaranteed to be output that will indicate what you're looking for.
This is especially true since you can create HTTP handlers that will output anything you want.
There is no such thing as ASP.NET 3.5. Only 2.0 (and soon, 4.0).
Keep in mind that .NET 3.5 is just some extra assemblies on top of some .NET 2.0 service packs. There is no new CLR, hence, no new ASP.NET version.
ASP.NET 2.0 websites might be running v2.0 or v3.5 frameworks and ASP.NET 4.0 websites might be running v4.0 or v4.5 frameworks
There are a couple of ways to check the exact version you are running, on your web page add:
<%= System.Environment.Version.ToString() %>
As an example;
- if you have v4.0 installed you'll see v4.0.30319.1008
- if you have v4.5 installed you'll see v4.0.30319.34209 That will get the currently running version. You can check the registry for all installed versions at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
Within this location look at the Version node.
- if you have v4.0 installated you will see v4.0.30319
- if you have v4.5 installated you will see v4.5.51209
精彩评论