Category Archives: User Controls

Debugging JavaScript in asp.net User Controls

Little while back I was facing issue is debugging JavaScript code written inside an asp.net User Control (ascx) file in visual studio 2010.

Interesting thing is that breakpoints doesn’t work for User Controls in asp.net but you could still do the debugging if you write debugger; keyword before the line where you want to set the breakpoint. The visual studio will automatically detect this keyword in your code and would pause the execution at that line in debug mode.

But in my case even the debugger keyword was not working. Whenever visual studio designer used to encounter this keyword, VS used to halt at the first line of page’s markup (pagename.asps[dynamic]), and by this I could not find that exactly which of my debugger statement got hit.

The issue seems to be of the page’s temporary file/markup generated by VS.

Solution

deleted the website’s .pdb file from project’s bin folder and things started working.

Hope this information would help someone other there in coding world.

Thanks