TraceContext.Warn Method (String, String, Exception)
Assembly: System.Web (in system.web.dll)
public void Warn ( String category, String message, Exception errorInfo )
public function Warn ( category : String, message : String, errorInfo : Exception )
Not applicable.
Parameters
- category
The trace category that receives the message.
- message
The trace message to write to the log.
- errorInfo
An Exception that contains information about the error.
Every time the Warn method is called, a TraceContext trace message is added to the TraceRecords messages collection, which is accessible when you handle the TraceFinished event. The message is added with its IsWarning property set to true, and the ErrorInfo property is set to the object passed by the errorInfo parameter.
The following code example demonstrates how to call the Write method to write an error trace message to the trace log. In this example, different exceptions are traced as errors and warnings. When the page throws an ArgumentException, it writes a warning message using the Warn method. When the page throws an InvalidOperationException, it writes an error message using the Write method.
Reference
TraceContext ClassTraceContext Members
System.Web Namespace
Exception