andrewdavey / NotFoundMvc

Provides a user-friendly '404' page whenever a controller, action or route is not found in your ASP.NET MVC3 application. A view called NotFound is rendered instead of the default ASP.NET error page.
91 stars 35 forks source link

Custom NotFound Controller #15

Closed tocsi-hun closed 11 years ago

tocsi-hun commented 11 years ago

I choose the Handler for the Function property. This way I was able to use it in the NotFoundHandler, in the ControllerFactoryWrapper and in the ActionInvokerWrapper and did not have to change the visibility of the latter two.

You can configure your own controller in Global.asax NotFoundMvc.NotFoundHandler.CreateCustomNotFoundController = requestContext => { //some sort of logic... return new MyCustomNotFoundController(requestContext); //or return null for default functionality };

andrewdavey commented 11 years ago

Thanks for this. I made a few small changes and refactorings, seen here https://github.com/andrewdavey/NotFoundMvc/commit/98313add4d10a3ad7bf500f46d14175402e29a65

The one that will affect you is renaming the delegate to NotFoundHandler.CreateNotFoundController.

I've also pushed a new release (v1.2.0) to nuget.