• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Error Redirection In ASP.NET

Hello Experts -
What is the least complicated way to configure an ASP.NET application to respond to site errors with a 'friendly' error message (as opposed to throwing an Application Error)?  Ideally I'd like to have an 'error.aspx' page with a generic message in it to which the app would redirect in the event that it encounters an error (any error).  Is there a quick and easy way to set that redirect up?  Thanks all.

-- Rick
0
MinnRick
Asked:
MinnRick
2 Solutions
 
djon2003Commented:
There is two simple ways : on the IIS server or within the ASP.NET page.

On IIS Server :
Within the properties of a website (or at the granularity you want to set it) you can go to the error message tab and set the 500 one to a file of your own.

In the page :
Add a try/catch that surrounds the whole code which in the catch you redirect to the page you want.
0
 
EyalCommented:
another way to go is altering the web.config customErrors section to match your needs
0
 
MinnRickAuthor Commented:
Thanks very much.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now