title: Received multiple email errors form Elmah
body: <p>2 for my ASP.NET web pages .NET 4.0 app.  I was using Enterpriselibrary to log and send error via email before the app was upgraded to .NET 4.0 but since its upgraded the EnterpriseLibrary logging has stopped logging so I have decided to switch to Elmah.</p>
  
  <p>In part of my web.config file of the app:</p>
  
  <pre><code>&lt;add name="ErrorHandler" type="myWebApp.ErrorHandlingModule, myWebApp" preCondition="managedHandler" /&gt;
              &lt;add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" /&gt;
              &lt;add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" /&gt;
              &lt;add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" /&gt;
  </code></pre>
  
  <p>As you can see there is already an Errorhandling module there (ErrorHandlingModule), which creates a custom error message ("ex" object in the following code).  Originally in the ErrorHandlingModule:</p>
  
  <pre><code>try
              {
                  ExceptionPolicy.HandleException(ex, "myWebApp Error Handling");
              }
              catch (Exception exApplicationBlockError)
              {
                  try
                  {
  
                      EventLog log = new EventLog("Application");
                      log.Source = "Application Error";
                      log.WriteEntry(exApplicationBlockError.ToString(), EventLogEntryType.Error);
                  }
                  catch
                  {
                  }
              }
  </code></pre>
  
  <p>Since I switch to Elmah:</p>
  
  <pre><code> try
              {
                  //ExceptionPolicy.HandleException(ex, "myWebApp Error Handling");
  
                  Elmah.ErrorSignal.FromCurrentContext().Raise(ex);                
              }
              catch (Exception exApplicationBlockError)
              {
                  try
                  {
  
                      EventLog log = new EventLog("Application");
                      log.Source = "Application Error";
                      log.WriteEntry(exApplicationBlockError.ToString(), EventLogEntryType.Error);
                  }
                  catch
                  {
                  }
              }
  </code></pre>
  
  <p>It works very well but the problem now is if there is any error it raises 2 error emails: one is the custom one, and the other the default Elmah one; and of course I only want the custom one.</p>
  
  <p>I haven't added any extra Elmah ErrorFilter in the program but I do need to have the custom exception in my email.</p>
  
  <p>Should I add a custom Elmah filter to filter out ALL the exceptions so Elmah won't send me the default error email? (Or any other suggestions?)</p>
  
  <p>Also attach the elmah config in web.config file if it is any help:</p>
  
  <pre><code> &lt;elmah&gt;        
      &lt;security allowRemoteAccess="false" /&gt;
      &lt;errorMail from="xxxx@myorg.au"  to="xxxxx@myorg.au"  subject="myWebApp error"  async="true" /&gt;
    &lt;/elmah&gt;
  </code></pre>
  
  <p>Thanks in advance.  Happy holiday!</p>