We encountered a problem after deploying our MVC3 Asp.net application to a client's site.
In the client site, a virtual directory has been created in IIS7 to which we need to deploy.
The problem is in web.config where we have specified a custom error page as
<!-- Custom Error Pages -->
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<error statusCode="404" path="/Error/Http404" responseMode="ExecuteURL" />
<error statusCode="403" path="/Error/Http403" responseMode="ExecuteURL" />
<error statusCode="500" path="/Error/ServerError" responseMode="ExecuteURL" />
</httpErrors>
The error page paths are not working properly. After an investigation, we found that I have to specify the virtual directory and set the path to /virtual_directory/Error/Http404
Is there a way I can specify the path relative to the virtual directory?
path="~/Error/Http404"but I'm afraid it won't work : iis.net/configreference/system.webserver/httperrors/error "If you choose the ExecuteURL response mode, the path has to be a server relative URL (for example, /404.htm)"