ASP.NET MVC Enum in Session
I am storing an Enum in the session:
Later on I am trying to retrieve the Enum by doing:
model.SelectedWorkflowStatus = Session["workflowstatus"];
Which obviously doesn't work. Any idea how I can convert the Session["workflowstatus"]; back to an Enum?
The Session will return the value back as object, you just need to cast it to the appropriate type i.e.
model.SelectedWorkflowStatus = (WorkflowStatusType)Session["workflowstatus"];