_ViewStart giving Nullreference exception with Multi Layouts.
Opened this issue · 0 comments
shahil229 commented
Im getting this error because MVC Postal seems to be overriding my root _ViewStart. The program runs normal without it. Postal _ViewStart is still at its default.
Postal seems to have an issue when there is more than one layout specified.
Unfortunately I need to have them.
if (this.User.IsInRole("Admin") || !this.User.Identity.IsAuthenticated)
{
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
else if (this.User.IsInRole("Territorial Strategic Planning Coordinator") || this.User.IsInRole("Programme Secretary") || this.User.IsInRole("IT") || !this.User.Identity.IsAuthenticated)
{
Layout = "~/Views/Shared/_LayoutLevel1.cshtml";
}`
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Is there any way to fix this?
Thanks for any help.