Session过期问题
来源:互联网 发布:linux代理服务器 编辑:程序博客网 时间:2024/05/16 00:32
SessionState 的Timeout),其主要原因有三种。
一:有些杀病毒软件会去扫描您的Web.Config文件,那时Session肯定掉,这是微软的说法。
二:程序内部里有让Session掉失的代码,及服务器内存不足产生的。
三:程序有框架页面和跨域情况。
第一种解决办法是:使杀病毒软件屏蔽扫描Web.Config文件(程序运行时自己也不要去编辑它)
第二种是检查代码有无Session.Abandon()之类的。
第三种是在Window服务中将ASP.NET State Service 启动。
http://community.csdn.net/Expert/topic/3100/3100218.xml?temp=.4426386
还有可能就是你在测试期间改动了,网站的文件。
我测试过没有问题!测试程序如下:
protected void Application_Start(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Application_Start"+DateTime.Now.ToLongTimeString()+"application id"+Application.ToString()),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
?
??protected void Session_Start(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Session_Start"+DateTime.Now.ToLongTimeString()+"SessionID="+Session.SessionID),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
??protected void Application_BeginRequest(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Application_BeginRequest"+DateTime.Now.ToLongTimeString()),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
??protected void Application_EndRequest(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Application_EndRequest"+DateTime.Now.ToLongTimeString()),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
??protected void Application_AuthenticateRequest(Object sender, EventArgs e)
??{
??}
??protected void Application_Error(Object sender, EventArgs e)
??{
??}
??protected void Session_End(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Session_End"+DateTime.Now.ToLongTimeString()+"SessionID="+Session.SessionID),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
??protected void Application_End(Object sender, EventArgs e)
??{
???SqlConnection con = new SqlConnection("server=localhost;database=YourDatabase;uid=sa;pwd=;");
???SqlCommand cmd = new SqlCommand(string.Format("insert into table1 (c) values('{0}')","Application_End"+DateTime.Now.ToLongTimeString()),con);
???con.Open();
???cmd.ExecuteNonQuery();
???con.Close();
??}
所有的代码都是Global里面的
- Session过期问题
- Session过期问题
- Session过期问题
- Session过期问题揭密
- Session过期问题
- Session的过期问题
- Session过期时间问题
- 设置Session过期问题!
- Session 过期问题
- session过期问题
- session过期问题
- session过期处理问题
- 设置session过期时间问题
- Java WEB Session过期问题
- CodeIgniter session过期时间问题
- 关于session过期的问题,
- birt session 过期问题,跨域问题
- Asp.net的Session过期问题
- java值传递彻底明白~
- 实现datagrid的foot中增加一个新增数据行,以解决datagrid不能新增数据的问题
- Microsoft Office Word 2003 中的 XML
- 利用Asp.net 动态创建DataList
- Taglib原理和实现
- Session过期问题
- Calling WebServices using Javascript
- 无法加载DLL(OCI.DLL),如何解决?
- 关于大小不变的对象的内存池管理
- 最新Tomcat配置最新发现
- Asp.net中的页面乱码的问题
- j2ee程序员应该掌握的linux知识
- 清除网页历史记录
- 【转]】水瓶的爱情