我使用下面的字典
在会话中存储了多个值
var get_values = new Dictionary();
get_values["name"] = model.Name; ;
get_values["address"] = model.Address;
get_values["phone"] = model.Phone;
get_values["email"] = model.Email;
Session["sess_values"] = get_values;
现在我想逐个从会话中获取值。我的问题是如何从名称,地址等会话中获取值?
答案 0 :(得分:0)
就像任何正常的dictionary
一样//you get your sesssion
var sessionDictionary =Session["sess_values"] as Dictionary<string, string>;
//then get the value, example for name
var TheName = sessionDictionary["name"];