存session:
Session["codes"] =要存的session字段
用哈希函数存多个:
System.Collections.Hashtable hs = new System.Collections.Hashtable();
hs.Add("code", codes); //存验证码
hs.Add("codetime",DateTime.Now.AddMinutes(15)); //验证码有效期15分钟
取session:
Session["codes"] //直接这样就好啦
用哈希函数取:
System.Collections.Hashtable ht = new System.Collections.Hashtable();
ht = Session["codes"] as System.Collections.Hashtable;
时间: 2024-10-05 22:38:30