ASP.NET Session的生命周期问题
2015-04-08 11:03
357 查看
/// <summary> /// 设置session /// </summary> /// <param name="name">session 名</param> /// <param name="val">session 值</param> public static void SetSession(string name, object val) { HttpContext.Current.Session.Remove(name); HttpContext.Current.Session.Add(name, val); HttpContext.Current.Session.Timeout = 1440; } /// <summary> /// 添加Session,调动有效期为1440分钟 /// </summary> /// <param name="strSessionName">Session对象名称</param> /// <param name="strValue">Session值</param> public static void Add(string strSessionName, string strValue) { HttpContext.Current.Session[strSessionName] = strValue; HttpContext.Current.Session.Timeout = 1440; } /// <summary> /// 添加Session,调动有效期为1440分钟 /// </summary> /// <param name="strSessionName">Session对象名称</param> /// <param name="strValues">Session值数组</param> public static void Adds(string strSessionName, string[] strValues) { HttpContext.Current.Session[strSessionName] = strValues; HttpContext.Current.Session.Timeout = 1440; }
相关文章推荐
- 关于asp.net Session丢失问题的总结
- 关于asp.net Session丢失问题的总结
- ASP.net中Session问题
- 关于ASP.NET Session 丢失问题
- 在ASP.NET中使用Session常见问题集锦
- Asp.net中处理一个站点不同Web应用共享Session的问题
- 在ASP.NET中使用Session常见问题集锦
- 关于asp.net Session丢失问题的总结
- 在ASP.NET中使用Session常见问题集锦
- [转]在ASP.NET中使用Session常见问题集锦
- 关于asp.net Session丢失问题的总结
- 对于ASP.net 2.0上传文件后session丢失问题的解决方案
- 关于asp.net Session丢失问题的总结
- 在ASP.NET中使用Session常见问题集锦
- 在ASP.NET中使用Session常见问题集锦
- ASP.net中Application生命周期的问题
- 关于ASP.NET Session 丢失问题
- Asp.net中处理一个站点不同Web应用共享Session的问题
- 在ASP.NET中使用Session常见问题集锦
- 在ASP.NET中使用Session常见问题集锦