6

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?

1
  • 1
    I would have said to try 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)" Commented Dec 3, 2013 at 12:43

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.