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.
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