I don't know if this method I'm trying to do is possible to do in asp.net. Just wanted to ask this from experts. :)
In my HTML view, I'm reading values from the session and assigning them to the select list item.
So sometimes when the session data is out and the user tries to refresh the Index page, then I got 'There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'MyBranch this error.
So I'm trying to do here to check is this returns null and then I want to redirect to the Action = Logoff, Controller = Account.
In my view, this is I tried
List<SelectListItem> MyBranch = Session["MyBranch"] as List<SelectListItem>;
if (MyBranch == null)
{
// Need to know here how to redirect this to action
}
Any ideas ?