debugging in (ASP).Net

D

Davids

many of you probably remember using Response.Write(...) for debugging
purposes, writing out the values of objects etc...
How can I do the same with c#/ASP.Net ? It would be great to see some text
I've put into - say - some debug string that is automatically output when
running into code error?
 
G

Guest

I still use response.write - in fact it's better now because you can put
response.write statments into the same page that renders HTML controls and
web controls.

But learn the Visual Studio debugger if you really want to get things done
quiclky - step thru code line by line, set breakpoints, watch all sorts of
data areas. Makes web development much more like regular programming.

There's also a tracing feature that's not bad.
 
D

Davids

well it's not possible to use Response if your code for instance is inside a
class (and called from the base class)?
 
D

Drew Berkemeyer

I suggest that you throw an exception from within your non ASP.NET classes
and catch it on your top level page. If you want to you can even create your
own exception class and handle it differently than sytem exceptions. We do
this in an application that I am currently working on to test for valid data
at the business object level and it works like a champ. If somehow the user
manages to enter data that is not caught by our client-side java scripts the
business object throwns an invalid argument exception. The call to save the
user's input to the DB, which is what started this whole process, is wrapped
with a try catch block at the ASP.NET page level. We test the exception type
and then display the error information to the user is in a context that is
both tidy and easy for them to understand.

Hope this helps.
--

Sincerely,
Drew Berkemeyer
Software Architect
http://www.berkemeyer.com/
 
G

Guest

I thought you are still able to user Contex.Trace.Write("whatever") or use
the Debug classes?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,206
Latest member
SybilSchil

Latest Threads

Top