I am using a standard Monorail/Windsor/ActiveRecord stack to build a web application. In the web application the controllers are registered (for Windsor) using a xml config file.
A ControllerNotFoundException will be (obviously) thrown by the MonoRailHttpHandlerFactory when a controller has not been defined in the config file.
Is there a way to catch this exception and to show a custom message to the user?
You could always find out what the error is in the Application_OnError() event handler in your GLobalApplication. We do something like this:
public virtual void Application_OnError()
{
var error = Server.GetLastError();
if ( error.GetType() != typeof( ControllerNotFoundException ) )
return;
// We don't want these errors in the event log
Server.ClearError();
//Handle page not found
Server.TransferRequest( "/rescue/pagenotfound" );
}