<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Coffeehouse - How to make custom error pages work in ASP.NET MVC 4?</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Coffeehouse - How to make custom error pages work in ASP.NET MVC 4?</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Wed, 19 Jun 2013 00:01:48 GMT</pubDate>
	<lastBuildDate>Wed, 19 Jun 2013 00:01:48 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>1</c9:totalResults>
	<c9:pageCount>-1</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Coffeehouse - How to make custom error pages work in ASP.NET MVC 4?</title>
		<description><![CDATA[<p>I want a custom error page shown for 500, 404 and 403. Here's what I have done:<br><br>1) Enabled custom errors in the web.config as follows:<br><br>&nbsp;&nbsp;&nbsp; <pre class="brush: xml">&lt;customErrors mode=&quot;On&quot;
       defaultRedirect=&quot;~/Views/Shared/Error.cshtml&quot;&gt;
      
      &lt;error statusCode=&quot;403&quot;
        redirect=&quot;~/Views/Shared/UnauthorizedAccess.cshtml&quot; /&gt;
      
      &lt;error statusCode=&quot;404&quot;
        redirect=&quot;~/Views/Shared/FileNotFound.cshtml&quot; /&gt;
    
    &lt;/customErrors&gt;</pre><br><br>2) Registered <strong>HandleErrorAttribute</strong> as a global action filter in the <strong>FilterConfig</strong> class as follows:<br><br>&nbsp;&nbsp;&nbsp; <pre class="brush: text">public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new CustomHandleErrorAttribute());
            filters.Add(new AuthorizeAttribute());
        }</pre><br><br>3) Created a custom error page for each of the above messages. The default one for 500 was already available out of the box.<br><br>4) Declared in each custom error page view that the model for the page is <strong>System.Web.Mvc.HandleErrorInfo</strong><br><br>For 500, it shows the custom error page. For others, it doesn't.<br><br>Is there something I am missing?<br><br>It does look like this is not all there is to displaying custom errors as I read through the code in the <strong>OnException</strong> method of the <strong>HandleErrorAttribute</strong> class and it is handling only 500.<br><br>What do I have to do to handle other errors?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/How-to-make-custom-error-pages-work-in-ASPNET-MVC-4/19163f658bb74bb6b9e3a12901562049#19163f658bb74bb6b9e3a12901562049</link>
		<pubDate>Sun, 16 Dec 2012 20:45:38 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/How-to-make-custom-error-pages-work-in-ASPNET-MVC-4/19163f658bb74bb6b9e3a12901562049#19163f658bb74bb6b9e3a12901562049</guid>
		<dc:creator>Sathyaish Chakravarthy</dc:creator>
		<slash:comments>1</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sathyaish Chakravarthy/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>