I need to see what values are passed to the model in my razor .cshtml view.
I try to set a breakpoint or write to Debug, but neither is working.
I am in a Debug mode, and also have
<compilation debug="true" targetFramework="4.5" />
in web.config
How can I debug a View C# code?
You can insert this line in the server-side portion of the .cshtml file:
System.Diagnostics.Debugger.Break();
When running the website, you will (or at least you should) see a system-level dialog prompting you to launch Visual Studio to debug the application (in this case, the w3wp.exe process.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With