Writing custom asp.net tracing messages Part 80

  • دعنا نشارك هذا :
ترتيب الدرس : 80
المدة : 00:10:47
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2012/12/writing-custom-aspnet-tracing-messages.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-80-writing-custom-aspnet-tracing.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

To write custom asp.net trace messages Trace.Write() and Trace.Warn() methods can be used. The only difference, between these 2 methods is that, the messages written using Trace.Warn() are displayed in red colour, where as the messages written using Trace.Write() are displayed in black colour. In fact, What is the difference between Trace.Write() and Trace.Warn() is a very common asp.net interview question.

Trace.IsEnabled property can be used to check if tracing is enabled. In the following code Trace.Write() method is invoked only if tracing is enabled. If you don't check, Trace.IsEnabled property prior to writing out trace messages, we don't get an exception. But if you are going to do any sort of significant work to build the trace message, then you can avoid that work by checking the IsEnabled property first.
if (Trace.IsEnabled)
{
Trace.Write("Debugging information");
}

With classic ASP, the only option for printing debugging information is Response.Write(). There are 2 problems with this
1. Actual end users also, can see the debugging information that you have written using Response.Write(). But with tracing, if pageoutput attribute is set to false, then the trace messages are written to the trace.axd file. End users cannot see the trace information.
2. All the Response.Write() statements must be removed, before the application is deployed to production. But with tracing, all you have to do is disable tracing in web.config.

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:24
youtube