0

What would be the best approach to prevent sensitive data being shown to the user when an Exception happens?

I've got an ASP.NET-MVC application which I recently updated to version 5 (not 5.1 yet). And whenever an Exception happens, I see data which I rather not want the user to see.

Quoter
  • 4,236
  • 13
  • 47
  • 69
  • 1
    You could set a custom action filter to catch unhandled exception and forward to a generic Error view that lets the user know an error has occurred. Decent write up on the subject here: http://www.codeproject.com/Articles/422572/Exception-Handling-in-ASP-NET-MVC – Botonomous Jan 29 '14 at 13:50

1 Answers1

1

Some options what you have in handling exception in ASP.Net MVC -

Option 1 - Use CustomErrors in web.config with custom controller

Option 2 - Exception handling with HandleError Attribute

Option 3 - Handle Application_Error globally

Community
  • 1
  • 1
ramiramilu
  • 17,044
  • 6
  • 49
  • 66