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?
If the virtual directory path is constant in your deployment environments, this answer might serve your purposes, with different web.config and web.release.config files.
If the virtual directory path can vary, the original questioner says it's not possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With