I want to access a session variable from my main layout page, but you don't have a model on the layout page, so how do I access this variable?
@{var sessionvar = Session["myVar"] as FooType;}
You must transfer this logic to the child action and invoke the child action from the main page with @Html.Action(...).
@Html.Action(...)
To answer a question, use a property Session.
Session
Source: https://habr.com/ru/post/1626860/More articles:How do I load some media files in the "http: // domain_name / folder_name" section for a specific page? - uploadInstagram Instagram Mapping - Previous Page - javascriptHow can I check if a user is logged into the MVC5 Layout file - asp.net-mvc-5Есть ли альтернатива Windows 8.1 SettingsFlyout в Windows 10 UWP? - c#Как можно равномерно распределить список, чтобы включить экстраполированные средние значения? - pythonHow to import node module passing subClass argument to ES6? - node.jsCalling the execute () member function for boolean in - phpИспользуйте другую оценку, основанную на значении - pythonGrails 3 Database Initialization Error - grailspyspark ml recommendation - All recommendations - apache-sparkAll Articles