📄 default.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//读取Cookie里的帐号和密码
HttpCookie cookie = Request.Cookies["userInfo"];
if (cookie != null)
{
this.userLogin.InnerHtml = "<p>" + cookie.Values["userName"].ToString() + " 同学,欢迎你回来 !<br/><br/><a href='index.aspx'>进入我的同学录</a></p>";
}
}
}
//成员登录
protected void btnLogin_Click(object sender, EventArgs e)
{
if (IsValid)
{
string _userName = this.txtUserName.Text.Trim();
string _userPwd = this.txtUserPwd.Text.Trim();
//Cookie存放时间
int _cookieDay = 0;
if (this.cookieYes.Checked)
_cookieDay = 14; //保存Cookie
else
_cookieDay = 0; //不保存Cookie
Logic lg = new Logic(); //创建Logic类对象
if (lg.UserLogin(_userName, _userPwd, _cookieDay)) //调用验证方法
Response.Redirect("index.aspx");
else
lg.Msg("帐号或密码错误!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -