Do you use Trace.Fail or set AssertUIEnabled="true" in your web.config?
v3.0
Posted at
20/10/2010 7:56 PM by
system
Rule Intro
Have you ever seen dialogs raised on the server-side? These dialogs would hang the thread they were on, and hang IIS until they were dismissed. In this case, you might use Trace.Fail or set AssertUIEnabled="true" in your web.config.
Page Content
See Scott's blog Preventing Dialogs on the Server-Side in ASP.NET or Trace.Fail considered Harmful
- public static void ExceptionFunc(string strException)
{
System.Diagnostics.Trace.Fail(strException);
}
- Figure: Never use Trace.Fail
- <configuration>
<system.diagnostics>
<assert AssertUIEnabled="true" logfilename="c:\log.txt" />
</system.diagnostics>
</configuration>
- Figure: Never set AssertUIEnabled="true" in web.config
- <configuration>
<system.diagnostics>
<assert AssertUIEnabled="false" logfilename="c:\log.txt" />
</system.diagnostics>
</configuration>
- Figure: Should set AssertUIEnabled="false" in web.config
Do you like this rule?
Do you follow this rule?