Custom Error Page for ASP.Net MVC

An error happens, and when it happens you want to display something nice to users, here is how.

Go to web.config, find <system.web>

Now go to App_Start/FilterConfig.cs, make sure filter is added, as below;

Then go to Views/_Shared, create new view.  Example;


ASP.Net Return Empty Results

When you get request but not able to return appropriate result back, it is good idea to return http status code to let them know what’s wrong.

And here is the list full

Ones that I use often

When input parameter is not valid

When the access is unauthorized

When there is nothing to show (likely had no matching data record to create page)

And when you want to tell search engine that page has been moved permanently, then use