ASP/.NET Web Hosting
* 3 Months FREE *
CLICK HERE!
 CoverYourASP --> Hidden debug data!

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
140 active users
10193 visitors today
11025 pages today
how is this done?
ASP.NET Showcase
ASP.NET Graph and Chart Component with FREE developer version

ASP.NET Shopping Cart and E-commerce Control with FREE trial download

ASP.NET Web Hosting with free month and setup

$15 Domain Name Registration from .DNR.
As seen on these sites
Special thanks go to the sites that support me by publishing my articles.
See more

CoverYourASP
Copyright © 1999-2008 James Shaw.
All rights reserved.

ASP.NET Blog
ASPRSS
ShawThing

Now open source with SourceForge!

This page is alive with extra information that can help you debug your pages. Can you see it?

Recently I had to debug a complex ASP page. The page asked the user for some information which it used to look up a lot of interelated data in a database. Then it called a COM component which calculated an answer. The rules were quite complex to say the least!

What I needed was a way to optionally display some information on the page so that the beta testers could help me pinpoint what had gone wrong during testing.

The answer is simple - test for a certain circumstance, and optionally do some Response.Write's with the data.

I do this on my development machine by testing if I'm running on a server called localhost, like this:
var sServer = "" + Request.ServerVariables ( "SERVER_NAME" );

bDebug = ( -1 != sServer.indexOf ( "localhost" ) );

The variable "bDebug" is then available for use wherever you need. For demonstration purposes this site uses a simpler strategy - you can simply add "?debug" to the URL's QueryString to see debug info!

You can test it easily by refreshing this page as Debug.asp?debug.

Featured sponsor
My favorite resources

Selling products online - read how James does it now



New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!