Debugging Classic ASP

October 22, 2010
How wonderful it would be if we only worked on the latest and greatest! But Alas! That is not meant to be.

I’ve been using VS2003 to debug Classic ASP web sites we still support. The ability to insert breakpoints and step through the code has been great.

Recently I decided to use VS2010 to accomplish the same thing and here is what I’ve found out so far.

Visual Studio 2010 Splash Screen

I complicated my life a little bit more 🙂

Looking around the web I found various articles that discussed the steps to accomplish said debugging.

The first thing you need to do is make sure your classic ASP site is set as the default web site in your local IIS. The built in web server will not work with classic ASP sites.

Setting it up the classic ASP site as the default website was kind of odd for me. Since that’s not how we did it when using VS2003. We would have a normal local website and just open it using VS2003.

Well it was not that easy, you would create a new project add all the folders and files to it and then run it. That has not changed, it’s just that now the website you are debugging is at the top of the hierarchy in your local IIS.
Internet Information Server Properties Window

It is also important that you click on your Configuration button for the site:

Once you’re there, click on the Debugging tab and check Enable ASP server-side script debugging as well as client-side script if you need to.

Application Configuration Window

Make sure you apply, click Ok on the previous screen and you’re site is ready to be debugged.

But if you hit the start debugging button or press F5, you’ll get all sort of nasty errors.

What you have to do is view in browser first. That’s Ctrl+Shift+W or click the View in Browser icon:

You can get to Ctrl+Shift+W through the keyboard, the icon or under the File -> View In Browser menu item. This will start your website on your browser, running on your local IIS.

You are of course not done yet. You must attach to the process. And you do that by clicking on the menu item Debug -> Attach to Process, or menu item Tools -> Attach to Process or keyboard combination of Ctrl+Alt+P.

There was a write up back in 2006 for VS2005 here: Attaching to Process

It even has some code to create a macro to bypass this Ctrl+Umpteen+More madness!

Finally stepping through code in all it’s glory in Classic ASP:

Stepping through ASP code.

Classic ASP lives on!


How would you improve this?

April 21, 2010

The code below is what is mostly generated by Iron Speed code designer. I usually do most of the look up information linking on the database using foreign key links.

The look up table has three columns. A system id or code, a meta_type for categories and a description.

The filtering category is placed at the “somevalue” place holder. This whole thing is inserted into the section where the function affects the rows in question.

Some databases have multiple look up tables I use mostly one with categories to filtered for each look up.

Simple lookup table design.

Lookup table design.


#Region “Code Customization”

”’
”’ Override the PopulateSYS_IDDropDownList function to filter contents of Dropdown list.
”’
Protected Overrides Sub PopulateCODE_SYSIDDropDownList( _
ByVal selectedValue As String, _
ByVal maxItems As Integer)

‘ Set up the WHERE clause.
Dim wc As WhereClause = New WhereClause
wc.iAND(CODE_TABLETable.META_TYPE, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, “somevalue“)

Dim orderBy As OrderBy = New OrderBy(False, True)
orderBy.Add(CODE_TABLETable.SYS_ID, BaseClasses.Data.OrderByItem.OrderDir.Asc)

Me.CODE_SYSID.Items.Clear()
Dim itemValue As CODE_TABLERecord
For Each itemValue In CODE_TABLETable.GetRecords(wc, orderBy, 0, maxItems)

‘ Create the item and add to the list.
Dim cvalue As String = itemValue.SYS_ID.ToString()
Dim fvalue As String = itemValue.Format(CODE_TABLETable.DESCRIPTION)
Dim item As ListItem = New ListItem(fvalue, cvalue)
Me.CODE_SYSID.Items.Add(item)
Next

‘ Set up the selected item.
If Not selectedValue Is Nothing AndAlso _
selectedValue.Trim “” AndAlso _
Not SetSelectedValue(Me.CODE_SYSID, selectedValue) Then
Dim fvalue As String = OSERVICES_PROVIDEDTable.CODE_SYSID.Format(selectedValue)
Dim item As ListItem = New ListItem(fvalue, selectedValue)
item.Selected = true
Me.CODE_SYSID.Items.Insert(0, item)
End If

‘ Add the Please Select item.
Me.CODE_SYSID.Items.Insert(0, New ListItem(MiscUtils.GetValueFromResourceFile(“Txt:PleaseSelect”, “Application”), “–PLEASE_SELECT–“))
End Sub

#End Region


Visual Studio 2010 New Features Map (will grow).

April 12, 2010

There are many new features available in VS 2010. Can’t wait to start using it. Meanwhile I’ve mapped the new features being highlighted in videos and other blogs. This list will get bigger I’m sure, especially the bugs list. The subtopic place holders are for features I’ll add later 🙂

Mind Map of Visual Studio 2010's New Features

Visual Studio 2010 New Features


ASP.NET Page Life Cycle via Mind Map

April 5, 2010

This begins a series of simple mind maps, describing certain features of the ASP.NET framework. I’m sure there’s many such things out there, doing this for my reference as well of others.

ASP.Net Page Life Cycle

Simple description of page life cycle.