Tracing ================================================================================ What is Tracing in ASP.Net? Tracing allows us to view in detail how the code was executed. What are the types of tracing in ASP.Net? i) Page Level Tracing ii)Application Level Tracing What is Page Level Tracing? Page Level Tracing allows you to write debugging messages directly to the web form. Which class of ASP.Net supports Page Level Tracing? System.Web.TraceContext What methods are available to write Trace Messages? i) Trace. Write ii)Trace. Warn What is difference between Trace. Write and Trace. Warn? You can use this method to display messages within a web page while tracing an application. However, Trace. Warn appears in red. Write the syntax for the Trace. Write and Trace. Warn? i) Trace. Write (String Category, String Message, System.Exception errorinfo) ii)Trace. Warn (String Category, String Message, System.Exception errorinfo) What is Application Level Tracing? Application Level Tracing allows you to trace the entire application. How do we enable Tracing? < %@ Page Trace=”true” %> What are methods and properties of TraceContext object? Properties: i) IsEnabled ii)TraceMode Methods: i) Trace.Write ii)Trace.Warn How can I see the Trace messages? For Page Level Tracing specify the Page Directive as < % @Page Trace="true" %> You can view the page on which trace is enabled to true to see the details. For Application Level Tracing modify web.config as < configuration> < system.web> < trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /> < /system.web> < /configuration> You can view the Trace at http://< server >//trace.axd < %@ Page Language="vb" Trace="true" %> What is the result of including the line above in your code? i) Application-level tracing is enabled. ii) Page-level tracing is enabled. (Ans) iii)Network-level tracing is enabled. iv) Domain-level tracing is enabled. v) Server-level tracing is enabled. < trace enabled="true"/> What is the result of including the line above in the web.config file? i) Server-level tracing is enabled. ii) Page-level tracing is enabled. iii)Application-level tracing is enabled. (Ans) iv) Network-level tracing is enabled. v) Domain-level tracing is enabled. < configuration> < system.web> < trace enabled="true" requestLimit="30" pageOutput="false" traceMode="SortByTime" /> < /system.web> < /congiguration> What is the result of including the code above in the web.config file? i) Trace information will be collected for up to 30 requests; trace statements will NOT be output to the browser and will NOT be output to the file trace.axd. ii) Trace information will be collected for up to 30 requests; trace statements will NOT be output to the browser, but will be output to the file trace.axd. (Ans) iii)Trace information will be collected for up to 30 minutes; trace statements will NOT be output to the browser and will NOT be output to the file trace.axd. iv) Trace information will be collected for up to 30 minutes; trace statements will NOT be output to the browser, but will be output to the file trace.axd. v) Trace information will be collected for up to 30 minutes; trace statements will be output to the browser, but will NOT be output to the file trace.axd. Explanation: Enabled : Indicates whether Tracing is enabled for the application (default is false). RequestLimit : Number of trace requests to store on the server (default is 10). PageOutput : Indicates whether trace information should be rendered at the end of each page - or only accessible via the trace.axd utility (default is false) TraceMode : Indicates the display order for Trace messages (default is SortByTime) LocalOnly : Indicates whether Tracing is enabled for localhost users or for all users (default is true)
Example #1: ===============
[Tracing.aspx] Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Trace.Write (“Page Load”,” Here we are!”) End Sub
|
No responses found. Be the first to respond and make money from revenue sharing program.
|