Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Best Way To Debug ASP Pages

Reply
Thread Tools

Best Way To Debug ASP Pages

 
 
Matthew Louden
Guest
Posts: n/a
 
      09-27-2003
I want to know what's the best way to debug ASP pages? Now, I just put the
following code when I got run-time error, but sounds like not efficient.
Please advice! Thanks!

Response.Write "Here"
Response.End



 
Reply With Quote
 
 
 
 
PB4FUN
Guest
Posts: n/a
 
      09-27-2003
1. Visual Interdev
Real debugging like in Visual Basic : line by line,
asking values of variables, set a watch, change variables in runtime
etc.
2. On top of page ad On Error Resume Next
After each line of code use
If Err.Number <> 0 Then
Response.Write Err.Description
Err.Clear
End if
You might also Set a Debuggingvariable e.g. intDebug that you increase every
x lines
intDebug = intDebug + 1

If Err.Number <> 0 Then
Response.Write intDebug
response.Write "<BR>"
Response.Write Err.Description
Err.Clear
End if

But first option (Visual Interdev) is the best IF you get it working.

Meindert, MCP

> I want to know what's the best way to debug ASP pages? Now, I just put the
> following code when I got run-time error, but sounds like not efficient.
> Please advice! Thanks!
>
> Response.Write "Here"
> Response.End
>
>
>



 
Reply With Quote
 
 
 
 
Chris Barber
Guest
Posts: n/a
 
      09-28-2003
See the following for details of how to set it up (Visual Interdev
Debugging).

http://www.windowswebsolutions.com/A...rticleID=20431

http://www.microsoft.com/mind/0299/b...beyond0299.asp

Chris.

"PB4FUN" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
1. Visual Interdev
Real debugging like in Visual Basic : line by line,
asking values of variables, set a watch, change variables in runtime
etc.
2. On top of page ad On Error Resume Next
After each line of code use
If Err.Number <> 0 Then
Response.Write Err.Description
Err.Clear
End if
You might also Set a Debuggingvariable e.g. intDebug that you increase every
x lines
intDebug = intDebug + 1

If Err.Number <> 0 Then
Response.Write intDebug
response.Write "<BR>"
Response.Write Err.Description
Err.Clear
End if

But first option (Visual Interdev) is the best IF you get it working.

Meindert, MCP

> I want to know what's the best way to debug ASP pages? Now, I just put the
> following code when I got run-time error, but sounds like not efficient.
> Please advice! Thanks!
>
> Response.Write "Here"
> Response.End
>
>
>




 
Reply With Quote
 
C. Olive
Guest
Posts: n/a
 
      10-01-2003
"PB4FUN" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 1. Visual Interdev
> Real debugging like in Visual Basic : line by line,
> asking values of variables, set a watch, change variables in runtime
> etc.
> 2. On top of page ad On Error Resume Next
> After each line of code use
> If Err.Number <> 0 Then
> Response.Write Err.Description
> Err.Clear
> End if
> You might also Set a Debuggingvariable e.g. intDebug that you increase every
> x lines
> intDebug = intDebug + 1
>
> If Err.Number <> 0 Then
> Response.Write intDebug
> response.Write "<BR>"
> Response.Write Err.Description
> Err.Clear
> End if
>
> But first option (Visual Interdev) is the best IF you get it working.
>
> Meindert, MCP
>
> > I want to know what's the best way to debug ASP pages? Now, I just put the
> > following code when I got run-time error, but sounds like not efficient.
> > Please advice! Thanks!
> >
> > Response.Write "Here"
> > Response.End
> >
> >
> >


Another useful method I've used on any server, not just IIS, is
writing HTML comments to the client. Then use "View Source" to see
the comments sprinkled along with the actual visible markup. Under
IIS, an ASP subroutine like this works great:

Sub Debug( strMsg )

Response.Write "<!-- " & strMsg & " -->" & vbCRLF

End Sub

....then in code...

While Not RS.EOF
Response.Write "<td>" & RS.Name & "</td>"
Debug RS.Address 'Not sure what to do with this yet
Debug RS.City 'Is this coming out right?
Debug RS.State 'etc.
Loop

Chris
-----
Chris Olive
chris [I'm at] technologEase [dot] com
http://www.technologEase.com
(pronounced "technologies")
 
Reply With Quote
 
J. Spraul
Guest
Posts: n/a
 
      10-01-2003
IIS v5+ has an exponential increase in error-handling
support. I guess if you're talking about debugging
during development, then this may not be as much
of an interest to you, but you can read more here...

http://www.devarticles.com/art/1/382

If you don't have Visual Interdev + IIS installed on
your development machine then you won't be able to
step through your ASP (and some people still can't
even when they do have both installed - it's a
royal pain to get working). Here's that info...

http://support.microsoft.com/support.../Q244/2/72.ASP

If you want, you can use a subroutine to make it
a little easier (it's been a while since I've done
this, but I think it will work). Just put the main
logic of your code in a subroutine, like this...

SUB Main()
'do your stuff here...

END SUB

' this is the only non-subroutined ASP on the page...
ON ERROR RESUME NEXT
CALL Main
IF Err.Number THEN Response.Write Err.Description


You can switch to Server.GetLastError() if you're
using IIS 5/ASP 3 so you can get more info, like
the line that the error occurred on. If you didn't
mind using this same approach in production, you
could stick the part the calls Main in an include
and have a SUB Main in every ASP file which pulls
in the include... then you can switch between
debugging & "notify me when something wrong happens
because it should work" modes. Here is some info
specifically on the GetLastError/ASPError stuff...

http://www.devguru.com/Technologies/.../asperror.html

~jed

"Matthew Louden" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> I want to know what's the best way to debug ASP pages? Now, I just put the
> following code when I got run-time error, but sounds like not efficient.
> Please advice! Thanks!
>
> Response.Write "Here"
> Response.End

 
Reply With Quote
 
Bullschmidt
Guest
Posts: n/a
 
      10-02-2003
Of course Response.Write's are a good way to do some debugging.

For example in a login page where the user's access level is assigned to
a session variable one could do something like the following:
Response.Write objRST("UserName") & "<br>"
Response.Write objRST("UserPassword") & "<br>"
Response.Write objRST("UserAccess") & "<br>"
Response.Flush
Response.End

The second of the last line above is often required if buffering is set
on (Response.Buffer = True) which it perhaps usually would be.
The last line above is optional for if you need to stop the code from
running after that point (i.e. to avoid a page redirect or something).

Debugging your ASP Scripts by Abd Shomad - 2/10/1999
http://www.4guysfromrolla.com/webtech/021099-1.shtml

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to debug classic ASP pages during AJAX calls in ASP.NET website And Wan ASP General 3 08-09-2009 12:59 AM
How to debug classic ASP pages during AJAX calls in ASP.NET website And Wan ASP .Net 3 08-09-2009 12:59 AM
whats the best way to have multiple language asp pages? mike ASP General 1 09-14-2005 11:43 PM
Best way for a .NET developer to work with/debug classic ASP olav_net@hotmail.com ASP General 2 06-01-2005 01:03 PM
Best way to debug XSL? Matt XML 2 10-15-2004 08:33 AM



Advertisments