It happens many times that you don’t have access to an ASP.NET server, except for FTP, and you’re interested in finding out the version of .NET Framework or ASP.NET that runs on that server.
To find out what version of ASP.NET you have installed and running on a server, using ASP.NET itself, you can use the System.Environment.Version – the easiest way is to create a version.aspx file containing the following lines:
<%@ Page Language="VB" %> <% Response.Write(System.Environment.Version) %>
If you access it using your browser, this should output something such as 1.1.xxxx or 2.0.xxxx which is the version currently running: ASP.NET 1.1 or ASP.NET 2.0. This code works the same way in C# as it does in VB.NET, by simply changing the Language attribute to C#.
If you receive an error, it’s most likely because the server administrator disabled the access to the System.Environment namespace. In that case you can still find the version by looking at the bottom of the error page, where you will notice the ASP.NET version being displayed.
You should be aware that System.Environment.Version gives you the version of ASP.NET that’s set to run for the current web application. Other web applications on the server could be set to use a different version of ASP.NET.