Ben Foster has a great article on setting up custom error pages in an MVC project that I typically refer to each time I create a new one. Recently, I've finally decided to work smarter, not harder, by setting up my own MVC seed project. Of course, this should include some pre-defined error pages. Unfortunately, error pages aren't exceedingly straight-forward. Caveats There are two types of error pages that we need to consider: Errors handled by MVC, and errors handled by IIS This method will not correctly set the status codes (it will return 200 since you are being served a file) This solution hard-codes the URL. That may or may not be acceptable for your application. Requires .NET 4.5.2+ Why Static HTML Files? In the event of an error in the MVC pipeline, IIS will not be able to serve an MVC page. If this is the case, your application w...
MVC Displaying posts tagged with MVC
I'm working on a project that has an MVC Web API that lives on a different server from an MVC5 application that needs to consume the API. Because the user information is stored in the same database as the rest of the information that the API is...Posted on Saturday, September 12, 2015
A robots.txt file is important because it tells search engine crawlers what they should and should not crawl. Unfortunately, they don't always listen, but we should take advantage of the ones that do! In today's world, websites aren't sim...Posted on Tuesday, September 8, 2015
Today I had an interesting issue with a custom authorization attribute, something I've written at least a dozen times in the last 6 months. I typically lock down my MVC projects using a lot of the built in frameworks, but where I'm s...Posted on Tuesday, October 28, 2014
I had put a decent amount of time and effort into creating this website, but unfortunately it is still seriously lacking in the content department. While I've been meaning to update it, I've been spending every free moment I have wor...Posted on Thursday, August 14, 2014