Setting a custom 404 error page programmatically

robinyak

New Member
In a regular ASP.NET application, you might have a customErrors section like the following:\[code\]<customErrors mode="On"> <error statusCode="404" redirect="Nice-FileNotFound-Page.aspx"/></customErrors>\[/code\]Is it possible to set the 404 error programmatically at Application_Start? Something like the following:\[code\]// Figure out which page should be used... using some logic somewhere in the application// (obviously) Pseudo-code: Application.ErrorCode.404.Page = Page-Found-Above\[/code\]
 
Back
Top