问题描述
web.config设置如下:<?xmlversion="1.0"?><configuration><appSettings><addkey="connstr"value="server=.;uid=abc;database=CCJZJT;pwd=cc3ccajt456"/></appSettings><connectionStrings/><system.web><sessionStatemode="InProc"stateConnectionString="tcpip=127.0.0.1:42424"sqlConnectionString="datasource=127.0.0.1;Trusted_Connection=yes"cookieless="false"timeout="20"/><httpRuntimemaxRequestLength="10240"useFullyQualifiedRedirectUrl="true"executionTimeout="300"minFreeThreads="8"minLocalRequestFreeThreads="4"appRequestQueueLimit="100"enableVersionHeader="true"/><authenticationmode="Windows"/><customErrorsmode="Off"defaultRedirect="GenericErrorPage.htm"><errorstatusCode="403"redirect="NoAccess.htm"/><errorstatusCode="404"redirect="FileNotFound.htm"/></customErrors><globalizationrequestEncoding="gb2312"responseEncoding="gb2312"culture="zh-CN"fileEncoding="gb2312"/></system.web></configuration>登录代码如下:publicclassloging{publicloging(){////TODO:在此处添加构造函数逻辑//}publicstaticvoidlo(stringusn,stringpwd){stringsql="selectAdminSIDfromTB_SecuritywhereAdminSName='"+usn+"'andAdminSPWD='"+pwd+"'";DataTabledt=DBDS.DB(sql).Tables[0];if(dt.Rows.Count>0){System.Web.HttpContext.Current.Session["uid"]=dt.Rows[0]["AdminSID"];System.Web.HttpContext.Current.Response.Write("<script>alert('登陆成功!');top.location.href='../admin_index.htm';</script>");//System.Web.HttpContext.Current.Response.Write("<script>alert('登陆成功!');top.parent.location.href='../admin_index.htm';</script>");}else{System.Web.HttpContext.Current.Response.Write("<script>alert('登陆失败,请填写正确的用户名和密码!');</script>");}}//判断用户是否登陆publicstaticvoidpd(){if(System.Web.HttpContext.Current.Session["admin"]==null){System.Web.HttpContext.Current.Response.Write("<script>alert('对不起,你还没有登陆!');this.location.href='login.aspx';</script>");}}}验证码代码如下:protectedvoidButton1_Click(objectsender,EventArgse){if(Request.Cookies["CheckCode"]==null){lblMessage.Text="您的浏览器设置已被禁用Cookies,您必须设置浏览器允许使用Cookies选项后才能使用本系统。";lblMessage.Visible=true;return;}if(String.Compare(Request.Cookies["CheckCode"].Value,txtCheckCode.Text,true)!=0){lblMessage.Text="验证码错误,请输入正确的验证码。";lblMessage.Visible=true;return;}else{stringun,upw;un=re.replace(TextBox1.Text);upw=re.replace(TextBox2.Text);loging.lo(un,upw);Session["admin"]=un;//lblMessage.Text="通过验证";//lblMessage.Visible=true;//return;}}问题描述:登录后不到一分钟,要求重新登录,反复如此.后台登陆非常麻烦.咨询了空间租用商,说不是服务器设置问题.急死我了
解决方案
解决方案二:
输出的session过期时间如下:Response.Write(Server.ScriptTimeout.ToString());输出结果是30000000半小时
解决方案三:
一直没有解决,谁能帮我啊~~~~~