姓名:<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br />
密码:<asp:TextBox ID="txtPwd" runat="server"></asp:TextBox>
<br />
<asp:CheckBox ID="chBox" runat="server" Text="记住一个月" />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="登录" />不选记住一个月,点登录也能正常登录.
当点了chBOx时,下次打开页面就会直接进入第二个页面突然脑袋卡壳了..Cookie值都取出来,就知道卡壳不知道怎么直接跳到下一个页面各位大哥大姐们帮我写个小例子,实现这样的功能..再此先多谢谢啦!
<br />
密码:<asp:TextBox ID="txtPwd" runat="server"></asp:TextBox>
<br />
<asp:CheckBox ID="chBox" runat="server" Text="记住一个月" />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="登录" />不选记住一个月,点登录也能正常登录.
当点了chBOx时,下次打开页面就会直接进入第二个页面突然脑袋卡壳了..Cookie值都取出来,就知道卡壳不知道怎么直接跳到下一个页面各位大哥大姐们帮我写个小例子,实现这样的功能..再此先多谢谢啦!
第二次判断有没有cookie,有就获取用户名和密码,然后验证,登陆
Request.Cookie["password"] = txtPassword.Text;取:string userName = Response.Cookie["userName"].ToString();
string password= Response.Cookie["password"].ToString();
{
string name=Response.Cookies["user"]["name"];
string pwd = Response.Cookies["user"]["pwd"];
查询验证
if(验证)
Response.Redirect(“xx”);
}
protected void Page_Load(object sender, EventArgs e)
{ Random Ran = new Random();
CookiesValue = Ran.Next(10000, 99999);
}
if (Request.Cookies["mycookies"] == null)
{ //添加cookies
HttpCookie cookies = new HttpCookie("mycookies");
cookies.Expires = DateTime.MaxValue;
cookies.Values.Add("key", CookiesValue.ToString());
Response.AppendCookie(cookies);
}