Custom error pages in ASP.NET MVC

Excellent blog post by Ben Foster:
Custom error pages in ASP.NET MVC. Easy, right? – Ben Foster

My extra take on it was to create content in the static .html pages and use an iframe inside the aspx based pages (to reuse the content easily).

E.g: (my 500 error page is named Error500.aspx)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Error500.aspx.cs" Inherits="Error500" %>
<% Response.StatusCode = 500; %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <title>An error has occurred - 500</title>
    <style>iframe, html, body { height: 100%; width: 100%; margin: 0; border: 0; padding: 0; }</style>
    <iframe src="Error500.html"></iframe>


Leave a Reply

Your email address will not be published. Required fields are marked *