I have a custom Error.aspx page in my ASP.NET MVC application. The error page uses the main page (which, in turn, uses a different main page), and on the main page there is an HtmlHelper call:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Unsecure.Master" ... %>
...
Html.RenderPartial("LogOnUserControl")
My web.config is configured to use this error page for all errors:
<customErrors mode="RemoteOnly" defaultRedirect="/Views/Shared/Error.aspx" />
The problem is that the Html ViewMasterPage property is NULL. I understand that this property is simply pulled from the ViewPage Html property, which is also null. Thus, any attempt to invoke a partial method against an HtmlHelper fails with a NullReferenceException.
Why is HtmlHelper null?
source
share