P. 1
Debug ASP

Debug ASP

|Views: 228|Likes:
Published by Raghunath Chandran

More info:

Published by: Raghunath Chandran on Aug 08, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/20/2012

pdf

text

original

As you will soon see, the structure of a page in previous versions of ASP is quite
different from that of an ASP.NET page. Pre–ASP.NET pages are severely lacking in
the structure department. Although there are a few ways to make your ASP code
slightly structured, several lines become blurred. This section talks about a few of
the common problems that developers run into when developing with previous
versions of ASP.

The Great Monolith

So how do you currently write ASP pages? Well, if you’re anything like us—and let’s
hope that you’re not, in some respects—your ASP pages have the structure of a
50-story skyscraper made out of Popsicle sticks. Now, don’t get us wrong: A certain
degree of structure can be attained with standard ASP programming, but it is not
the type of structure and organization that is obtained with a real programming
language. The fact is, there just isn’t any great way to write extremely structured
code in ASP like there is in Visual Basic or C#.

For example, if you have a series of “global” functions that are used throughout your
application, you probably shove them into an .asp file and use the #include file
directive to bring them into the rest of your .asp pages to avoid code repetition.
Although this might get the job done, you might not realize what is happening
behind the scenes with the script parser.

New Riders - Debugging ASP.NET made by dotneter@teamfly

By including pages in this manner, they simply get tacked on at the point where you
include them. This means that the entire included page is parsed and processed
even if only a single constant declaration, for example, is used out of it. Luckily,
because ASP.NET uses true, compiled languages, it gets you out of this bind.

Pasta Nightmare

You probably have heard the expression “spaghetti code,” which is code that lacks
structure and clear separation among the main elements. Traditional ASP code is
the epitome of spaghetti code. Code does not get much more tangled up in any
language quite like it does in ASP. The main reason for this is the lack of a distinct
separation between client-side presentation code and server-side business/logic
code.

In the traditional ASP environment, you generally wind up mixing your HTML
presentation layer with your VBScript server code, as shown in Listing 2.1.

Listing 2.1 A Typical ASP Page



<%

Dim pvNameArray
pvNameArray = Array("Jonathan Goodyear", "Brian Peek", "Brad Fox")
Response.Write ".PDFDownload

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->