Tuesday, February 5, 2013

Log errors to event log


try{
      
//Your method code here
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteEvent(0, new SPDiagnosticsCategory("My Error Category", TraceSeverity.Unexpected,
EventSeverity.ErrorCritical), EventSeverity.ErrorCritical, ex.Message, ex.StackTrace);
}

No comments:

Regex obfuscate email

 Use this code in C# to obfuscate email using regex // Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compile...