Use different ViewModel for ASP.NET MVC 3 global error page
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.

When I hit an error the shared/Error view gets compiled - however because it is referencing the layout file I'm getting this exception:

> 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'.

Any idea of how to solve this?

Here's the error view:

    @model System.Web.Mvc.HandleErrorInfo
    
    @{
        ViewBag.Title = "Error";
    }
    
    <h2>Sorry, an error occurred while processing your request.</h2>


Use different ViewModel for ASP.NET MVC 3 global error page
===

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.

When I hit an error the shared/Error view gets compiled - however because it is referencing the layout file I'm getting this exception:

> 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'.

Any idea of how to solve this?

Here's the error view:

    @model System.Web.Mvc.HandleErrorInfo
    
    @{
        ViewBag.Title = "Error";
    }
    
    <h2>Sorry, an error occurred while processing your request.</h2>

