1

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

2 Answers 2

2

You can put that logic in Nice-FileNotFound-Page.aspx and redirect from there to the appropriate page using any business logic you need.

Sign up to request clarification or add additional context in comments.

Comments

-1

This is not asp specific, but as long as "Nice-FileNotFound-Page.aspx" is a dynamic script, couldnt you just make is be whatever you want it to be? That is to say, let it figure out programatically what kind of page it is supposed to be based on the logic and then be that page?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.