<httpErrors> tag - respect tilde (~) or similar?

Using the old tag <customErrors>in the web.config files, you could write:

<customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPage/">
  <error statusCode="500" redirect="~/ErrorPage/E500" />
</customErrors>

And ~in redirect="~/ErrorPage/E500"is replaced by the root of the site.

However, when using it, <httpErrors>I found that the tilde is not respected;

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="500" path="~/ErrorPage/E500" responseMode="ExecuteURL"  />
</httpErrors>

The only way to “fix” this is for me to set the absolute path from the root of my site;

  <error statusCode="500" path="/MySites/SiteRoot/ErrorPage/E500" responseMode="ExecuteURL"  />

which feels really wrong. Is there a way to fix this or quote it in such a way that the URLs refer to the root of the site?

+4
source share

All Articles