tags:

views:

223

answers:

5

How can I tell if an App is ASP.NET 2.0 or ASP.NET 1.1. This is in C#

I don't have the source code and I don't have access to IIS Manager. But I can ftp and check the ASPX files. Any Ideas?

+6  A: 

if you can get an error message to show it will tell you at the bottom of the page what version of the framework is in use.

or, if you could upload a file, you could upload an aspx page containing code to output the framework version:

<%@ Page Language="C#" EnableSessionState="False" EnableViewState="False" Trace="False" Debug="False" %>

<script language="C#" runat="server">

protected void Page_Load(object s, EventArgs e)
{
    Response.Write(System.Environment.Version);
}
</script>

this was just typed in, there could be syntax or other code errors.

John Boker
This website is bulletproof. So robust. I could not crash it if I tried :D
Brian G
just added another thing, maybe try that?
John Boker
You could also temporarily enable tracing in web.config, then Trace.axd will include the framework version
stevemegson
+2  A: 

In 2.0, there was a change in the @Page directive to add the CodeFile attribute.

So, if you find that attribute, it's 2.0.

DOK
Similarly, if the .aspx.cs is a partial class then it must be 2.0. The catch with both is that the 1.1 way still works in 2.0, so you can't be sure that it's 1.1 if they're not there.
stevemegson
Good point, Steve. My suggestion was only one of many choices, and it's a quick test. You are assuming that the questioner has access to the .cs file, which seems to be part of the problem. He says he can only see the .aspx.
DOK
+2  A: 

Or you can just deliberately upload a test.aspx to cause an exception to be thrown; the default ASP.NET yellow screen of death will show the runtime version.

:-D

icelava
of course, no production application should let you see a yellow screen of death :)
stevemegson
Set debug="true" for a short while
icelava
+3  A: 
  1. Download the DLL of the application.
  2. Open them with Reflector
  3. Analyse the dll and look for "Depends on"

If it tries to load System.dll (or any core type) you will be able to see which version of the core components it depends on.

Maxim
+1  A: 

You can do this through your browser - just look in the response headers for "X-AspNet-Version"

In FireFox you can do this with the web developer toolbar... -> Information -> View Response Headers.

You can also check Response Headers with Fiddler

Or just use the ViewHtml website here to view Response Headers