The following table lists the methods of the Sys.Debug class. The Apple Safari and Opera browsers display trace messages in their respective debugging consoles. In Mozilla Firefox, you can view debugger trace messages by using tools that are available as extensions. If you are using Visual Studio and Internet Explorer, you can attach the Visual Studio debugger to the browser and view debugger trace messages in the Output window. If you are not using Visual Studio, you can view debugger trace messages in Internet Explorer by creating a textarea element on the page and setting its ID to TraceConsole. By calling methods of the Sys.Debug class, you can display objects in readable form at the end of the page, show trace messages, use assertions, and break into the debugger. ![]() Debug Helper ClassĪSP.NET provides the Sys.Debug class for debugging client applications. The page must also contain one or more UpdatePanel controls. Partial-page rendering is enabled when the page contains a ScriptManager control with its EnablePartialRendering property set to true. For more information about how to use the trace viewer, see ASP.NET Tracing Overview. However, the trace display is not updated as a result of asynchronous postbacks, because only the contents of UpdatePanel controls that have to be refreshed will change. You can append trace output to the end of the page, and it is displayed the first time the page is rendered. If you are using tracing on the server to debug Web pages that have partial-page rendering enabled, you should use the trace viewer (Trace.axd) to display trace output. The ScriptManager control uses only the settings in the Web.config file and in its IsDebuggingEnabled and ScriptMode properties to determine whether to render debug scripts. The debug attribute of the directive does not affect ASP.NET AJAX applications. Make sure that any Web page that contains a ScriptManager control has its ScriptMode property set to Release. In the Web.config file, if the compilation element contains a debug attribute, make sure that the debug attribute is set to false. To set the application to release mode, do the following: If you have created debug and release versions of your custom script files and script resources, ASP.NET also uses the release versions. This makes sure that ASP.NET uses the performance-optimized release version of the AJAX libraries. When you deploy a release version of an AJAX-enabled ASP.NET application, set the application to release mode. Setting the Application from Debug to Release Mode for Deployment When debugging is enabled, ASP.NET uses a debug version of the Microsoft AJAX Library and debug versions of your custom client script files, if available. The following example shows a section from a Web.config file that has the debug attribute set for debugging. For more information, see compilation Element (ASP.NET Settings Schema). To enable debugging, add a compilation element to the site's root Web.config file, and then set its debug attribute to true. Configuring the Application for Debugging The following sections provide detail about the techniques and tools that you can use for debugging and tracing. An extended Error object API provides helpful exception details with support for release and debug modes. It also shows trace messages, enables you to use assertions, and lets you break into the debugger. This enables you to throw exceptions in debug scripts but still keep the size of release code to a minimum.Ī debug helper class, Sys.Debug, provides methods for displaying objects in readable form at the end of a Web page. If you create debug versions of client script files or script resources, ASP.NET runs the debug versions when the application is in debug mode. Debug mode provides more robust debugging features, such as type and argument checking. Release mode provides error checking and exception handling that is optimized for performance, with minimized script size. The ASP.NET AJAX architecture provides a model for release and debug modes. Use external tools to capture HTTP traffic. Use the methods of the Sys.Debug class to set breakpoints and handle trace output.Īttach the Visual Studio 2008 debugger to your Internet Explorer instance, or use external tools to debug in other browsers. ![]() You can use the following approaches to debug an AJAX-enabled ASP.NET application at different stages of development:Įnable debugging in the configuration file. Please see the tool's Web site for licensing and support information. ![]() With the exception of Visual Studio and Internet Explorer, the programs mentioned in this topic are third-party tools and are not supported by Microsoft.
0 Comments
Leave a Reply. |