404 does not append aspxerrorpath for non aspx pag

2019-07-28 19:25发布

问题:

i am using ELMAH to log errors, it works fine for pages with aspx, i.e. eroordfs.aspx

but when it has a non aspx extension or no extension, my error page loads with no aspxerrorpath in the url, i think this is the reason that elmah is not logging the error.

i am using iis7.5

my web.config details are as follows:

<httpErrors errorMode="Custom">
            <remove statusCode="500" subStatusCode="-1" />
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
            <error statusCode="500" subStatusCode="-1" prefixLanguageFilePath="" path="/500.aspx" responseMode="ExecuteURL" />
        </httpErrors>

and

<customErrors mode="On">
      <error statusCode="404" redirect="~/404.aspx" />
      <error statusCode="500" redirect="~/500.aspx" />
    </customErrors>

thanks in advance for any advice you can offer