Thursday, September 6, 2007

How to debug your Javascript in .net 1.1 / 2.0

To debug your javascript code...

* Using Internet Explorer
Make sure that u untick Disable Script Debuging options.

* for Firefox.. There is extension plugin

*Configure your web config .. to enable debug...

* Press F5 for build with debugging instead of Shift + F5.


* You may need to separate your javascript into other file... It can not be embedded into your .aspx file because at the runtime.. your *.aspx content will dynamically converted into html...

However in VS 2005.. You can debug your embeded javascript...
But you can not directly put a break point into that line of code...
You need to Run first (F5) and go to DEBUG > WINDOWS > Script Explorer... You will see.. the merge javascript with your aspx which has been converted into html... and you can put the break point in there.


* USE ASP.NET AJax Extender...

You can use
Sys.Debug.trace("Whatever you want to trace - will appear in output window");
and
Sys.Debug.fail("It will stop in this point.. and you may start debugging");