views:

243

answers:

1

I've got an ASP.NET MVC site & I've got an Errors controller with a NotFound action which works great for 404 errors that pass though .NET, but for stuff that doesn't (like static files) I've set the Custom Errors value for 404 to URL with a value of /Errors/NotFound.

But when I do this & hit a non-existant page the site just gives me this:

The system cannot find the path specified.

Is this because it's a dynamic url, can IIS not redirect 404 requests to dynamic urls or have I screwed up the config somewhere?

UPDATE: this is the errors part of the web.config file

<customErrors mode="RemoteOnly" defaultRedirect="~/Error">
    <error statusCode="404" redirect="~/Error/NotFound" />
</customErrors>
A: 

I have this working in MVC and IIS6.

<customErrors mode="RemoteOnly" defaultRedirect="~/Error">
    <error statusCode="404" redirect="~/Error/PageNotFound" />
</customErrors>

This is my controller.

public class ErrorController : Controller
{
    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult Index()
    {
        return View();
    }

    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult PageNotFound()
    {
        return View();
    }
}
Dustin Laine
Yeah I've got that in the web.config now
Glenn Slaven
The only other thing I can think of is routing. What routes do you have?
Dustin Laine