Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Javascript debugging to work with my ASP.NET MVC application?

I can't seem to get Javascript debugging working for my ASP.NET MVC application even though I can for a traditional ASP.NET WebForm app.

I have followed the steps for unchecking the 'Disable Script Debugging' boxes for both IE and other.

when I add a simple function to display an alert in both the site.master and any content view the breakpoint will not fire.

Have i missed something obvious or do I need to use an outside tool for debugging like FireBug?

By the way, I'm using Visual Studio Web Developer Express 2008.

thx

like image 978
Mr. Kraus Avatar asked Nov 05 '08 08:11

Mr. Kraus


2 Answers

function test()
{
  debugger;
  alert("hi");
}

I don't know if it will work with express, but when IE hits the "debugger" instruction, it asks me if I want to debug, and with wich tool. Visual studio is present in the list of options presented to me.

I don't know if express will be present for you though.

"debugger" also works with firebug.

like image 128
Jean-Francois Avatar answered Sep 29 '22 12:09

Jean-Francois


I just had this problem today as well. The debugger doesn't know where you script files are if you include them in the mvc view.

Put them in an external .js file (say default.js) in the scripts folder, add a script tag in the site.master and then you will hit your breakpoints.

like image 37
tracileemt Avatar answered Sep 29 '22 13:09

tracileemt