Пример #1
0
  }//public static void Main

  /// <summary>Stub</summary>
  public static void Stub()
  {
   UtilityEventLog.WriteEntry
   (
    null,          //Log name
    null,          //Machine name
    null,          //Source
    null,          //Message
    EventLogEntryType.Information
   );
  }//public static void Stub()
  }//public void CreateUserWizard_SendingMail()

  /// <summary>CreateUserWizard_SendingMailError</summary>
  public void CreateUserWizard_SendMailError
  (
   object                  sender, 
   SendMailErrorEventArgs  sendMailErrorEventArgs
  )
  {
   UtilityEventLog.WriteEntry
   (
    "Application", //Log
    null,          //Machine name
    "Membership",  //Source
    "Sending mail via SMTP failed with the following error: " + 
    sendMailErrorEventArgs.Exception.Message.ToString(), 
    System.Diagnostics.EventLogEntryType.Error
   );
   sendMailErrorEventArgs.Handled = true;
  }//public void CreateUserWizard_SendMailError()
Пример #3
0
  }//public static main( string[] argv )

  ///<summary>ExceptionLog</summary>
  public static void ExceptionLog
  (
       Exception exception,
       string    exceptionClass,    
   ref string    exceptionMessage
  )
  {
   HttpContext       httpContext     =  HttpContext.Current;
   try
   {
   	if ( exceptionMessage == null )
   	{
   	 exceptionMessage = string.Format
   	 (
   	  "{0} Message: {1} | TargetSite: {2} | StackTrace: {3} | InnerException: {4} | Source: {5} | HelpLink: {6}",
      exceptionClass,
      exception.Message,
      exception.TargetSite,
      exception.StackTrace,
      exception.InnerException,
      exception.Source,
      exception.HelpLink
     );
    }//if ( exceptionMessage == null )
    if ( httpContext == null )
    {
     System.Console.WriteLine( exceptionMessage );    	
    }
    UtilityEventLog.WriteEntry
    (
     exceptionMessage
    );
   }//try
   catch ( Exception e )
   {
    exceptionMessage = "Exception: " + e.Message;
   }//catch ( Exception exception )
  }//public static ExceptionLog()