title: Use different ViewModel for ASP.NET MVC 3 global error page
body: <p>I'm using a global filter to handle errors in ASP.NET MVC 3 (with Razor views).  However, my shared/_Layout view requires a view model which I've called PageViewModel.</p>
  
  <p>When I hit an error the shared/Error view gets compiled - however because it is referencing the layout file I'm getting this exception:</p>
  
  <blockquote>
    <p>Exception message: The model item passed into the dictionary is of
    type 'System.Web.Mvc.HandleErrorInfo', but this dictionary requires a
    model item of type 'ViewModels.PageViewModel'.</p>
  </blockquote>
  
  <p>Any idea of how to solve this?</p>
  
  <p>Here's the error view:</p>
  
  <pre><code>@model System.Web.Mvc.HandleErrorInfo
  
  @{
      ViewBag.Title = "Error";
  }
  
  &lt;h2&gt;Sorry, an error occurred while processing your request.&lt;/h2&gt;
  </code></pre>