Personal I have a controller where I set two session keys and they capture these key anywhere in the application. (other controller , or a view ).
The controller looks like this:
[HttpGet]
public ActionResult TimetableSelect(int currentTimetableId, string currentTimetableName)
{
Session["TTBId"] = currentTimetableId;
Session["TTBName"] = currentTimetableName;
return RedirectToAction("Dashboard");
}
But in the view I would refer to the same as below, and is always returning null.
@if (Session["TTBId"] != null && Session["TTBName"] != null)
{
....
}
Can anyone tell me what I'm doing wrong?