How to write Debug directive in CS file?

In aspx file, it is written as "<%@ Page Language=C# Debug="True">". In CS file, how to write it.

My purpose is to get a pdb file after compilation of the cs file into dll file, so that I might trace the line number once some errors occur in web application.

Thks a lot!




Answer this question

How to write Debug directive in CS file?

  • Rob1234

    in ASP.NET it is done by web.config file. You can specify debug version like this

    <system.web>
         <compilation defaultLanguage="c#" debug="true">
         </compilation>
    </system.web>

    and release like this

    <system.web>
         <compilation defaultLanguage="c#" debug="false">
         </compilation>
    </system.web>



  • johnvarney

    If you are using ASP.NET 1.1 and VS2003, you'll need to change your project to select the debug configuration (go to Build -> Configuration Manager on the menu). This controls the settings for the assembly with your code-behind.

    In ASP.NET 2.0 / VS2005, with the default web site project model, it's all controlled by web.config. See: http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx



  • vkas7

    Galin,

    Thank you.

    As you said, I specified debug in web.config file. And then compiled the cs file into dll again, but I got no pdb file! After running my web application and error occurs, I still get no pdb file.

    How to do Thank you very much!



  • Billakong

    you do not need .pdb files in ASP .NET

    in previous post you hav everything you need to see code line with the error



  • Boris Mueller

    Can anybody tell me how to handle it

  • How to write Debug directive in CS file?