I need to change the layout according the user in the _viewstart.chtml . I have seen the answers in the question Why can't _ViewStart.cshtml access the ViewBag object? and the answers suggests to use ViewContext.ViewBag but in mvc 5 i have the error
An object reference is required for the nonstatic field, method, or property
So how i can use the viewbag or ViewContext in _viewstart.chtml.
The code will compile and there's no error in the runtime despite there being an error in the _viewstart code