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:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...