How to get the controller session value in layout page
Can any one tell me how to get the controller session value in layout page
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
suraj ghosi30 reputationPosted Apr 29, 2015, 10:14 PM EDT
public actionresult mycontroller()
{
viewbag["myvalue"]="this is test value";
retrun view();
}
in your layout page my.cshtml. you can access the viewbag value
@Html.LableFor(@viewbag["myvalue"])