postal icon indicating copy to clipboard operation
postal copied to clipboard

_ViewStart giving Nullreference exception with Multi Layouts.

Open shahil229 opened this issue 8 years ago • 0 comments

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.

shahil229 avatar Jan 28 '16 23:01 shahil229