title: 404 custom error page redirects to a blank white for .html pages
body: <p>I have made custom error page on asp.net and it works good only for .aspx pages
  For .htm pages it redirects to a blank page. Help please, a have no strength any more((</p>
  
  <p>This is my code in Global.asax - </p>
  
  <pre><code>protected void Application_Error(object sender, EventArgs e)
          {
              Exception ex = Server.GetLastError();
              if (ex is HttpException)
              {
                  if (((HttpException)(ex)).GetHttpCode() == 404)
  
                      Server.Transfer("~/error404.htm");
              }
              Exception objErr = Server.GetLastError().GetBaseException();
              string err = "Error in: " + Request.Url.ToString() +
                                ". Error Message:" + objErr.Message.ToString();
              Server.Transfer("~/ErrorPage.aspx");
          }
  </code></pre>
  
  <p>and in Web.config - </p>
  
  <pre><code>&lt;system.web&gt;
  &lt;customErrors mode="On" defaultRedirect="~/ErrorPage.aspx"&gt;
        &lt;error statusCode="404" redirect="~/error404.htm"/&gt;
      &lt;/customErrors&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>and -</p>
  
  <pre><code>&lt;system.webServer&gt;
       &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;httpErrors errorMode="Custom"&gt;
        &lt;remove statusCode="404" subStatusCode="-1"/&gt;
        &lt;error statusCode="404" path="~/error404.htm" responseMode="ExecuteURL"/&gt;
      &lt;/httpErrors&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>HELP!!(( Thanks!</p>