In a regular ASP.NET application, you might have a customErrors section like the following:
<customErrors mode='On'> <error statusCode='404' redirect='Nice-FileNotFound-Page.aspx'/> </customErrors>
Is it possible to set the 404 error programmatically at Application_Start? Something like the following:
// Figure out which page should be used... using some logic somewhere in the application // (obviously) Pseudo-code: Application.ErrorCode.404.Page = Page-Found-Above
You can put that logic in Nice-FileNotFound-Page.aspx and redirect from there to the appropriate page using any business logic you need.