donut
donut

Reputation: 9507

How to tell the difference between ASP and ASP.NET code/website files

I'm jumping into updating an ASP(.NET) website coming from a PHP background and am trying to get my bearings. I think it's ASP (not .NET) since the code is not compiled and it seems to be using ADODB, but I'm really quite clueless.

So, how can I tell if the code I'm working with is ASP or ASP.NET? Bonus points if you can tell me how to know what version of ASP(.NET) I'm working with.

Upvotes: 3

Views: 3370

Answers (5)

synhershko
synhershko

Reputation: 4492

What everyone said before is quite all you need to know to differentiate between ASP Classic and ASP.NET.

As for versions, ASP Classic is most of the time 3.0, and this is probably what you have if it is classic.

For .NET, openning a .csproj or .sln file in Visual Studio (if such exists) is the fastest way to find out - just go to the project properties and see what framework it is targeting. System.Environment.Version.ToString() might give you that, but it might not.

You'll need to look for some language characteristics that weren't supported in earlier versions to know it is a certain version. For example, LINQ (SQL'ish code syntax) only exists for 3.5+. The keyword "var" wasn't used often in 2.0. And so on.

Upvotes: 1

AMIT
AMIT

Reputation: 549

As a first basic step, shouldn't it be as easy as checking the file extension? But there is an interesting but old article at this link http://www.codeproject.com/KB/aspnet/ASPNET_vs__ASP.aspx which goes in a little detail.

About the version, you may get the version using System.Environment.Version.ToString()

Upvotes: 0

devio
devio

Reputation: 37225

ASP file extension is .asp, whereas ASP.Net has .aspx.

ASP files contain VBScript code between <% and %> tags, and may start with

<%@ Language=VBScript %>

ASPX files start with the line

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pagename.aspx.cs" 
        Inherits="webname.pagename" %>

and typically contain components marked by tags such as < asp:Label ... > and have a code-behind file called .aspx.cs or .aspx.vb.

Upvotes: 9

JB King
JB King

Reputation: 11910

What language is used in the files? If it is something ending in "script" then it is likely classic ASP and not ASP.Net, assuming you can see what language is used in the files. The extensions are usually different but this can circumvented by changing how IIS handles various file extensions.

Upvotes: 0

Jaime
Jaime

Reputation: 6814

An asp.net site would have its files ending with .ASPX and asp would just have .ASP.

Now in ASP.NET you can have "code behind" files that would appear as a file with ".aspx.cs" (when in C#) or ".aspx.vb" (when in visual basic), but not necesarly; you could have the code inside the ASPX pages.

Maybe if you post a snippet of the code that you're looking at we can give you more info

Upvotes: 0

Related Questions