1.ASP.NET ç½ä¸ä¹¦åºä»£ç
ASP.NET ç½ä¸ä¹¦åºä»£ç
//ç»å½æé®åºè§¦åçäºä»¶
protected void btnLoad_Click(object sender,书上书声音降噪源码 EventArgs e) {
//æ¸ ç©ºsession["uid"]çå¼
Session["UID"] = null;
//æ¸ ç©ºsession["username"]çå¼
Session["Username"] = null;
//å¤æç¨æ·ååå¯ç è¾å ¥æ¯ä¸æ¯ä¸ºç©º
if (txtName.Text.Trim() == "" || txtPassword.Text.Trim() == "") {
//å¦æ为空 æ示è¿å¥è¯,è¿åä¸ä¸é¡µé¢
Response.Write("<script>alert('ç»å½ååå¯ç ä¸è½ä¸ºç©ºï¼');
location='javascript:history.go(-1)';</script>");
}
else {
//éªè¯ éªè¯ç æ¯å¦æ£ç¡®
if (txtValid.Text.Trim() == lbValid.Text.Trim())
{
//éªè¯ç¨æ·ååå¯ç æ¯å¦æ£ç¡®
int P_Int_IsExists = uiObj.UserExists(txtName.Text.Trim(),
txtPassword.Text.Trim());
//å¦æè¿åå¼æ¯ å表æ ç¨æ·åå¯ç æ£ç¡®
if (P_Int_IsExists == ) {
//è·åç¨æ·çåºæ¬ä¿¡æ¯ èµå¼ç»dataset
DataSet ds = uiObj.ReturnUIDs(txtName.Text.Trim(),
txtPassword.Text.Trim(), "UserInfo");
//è®°å½ç¨æ·çsession["uid"]å¼
Session["UID"] = Convert.ToInt(ds.Tables["UserInfo"].
Rows[0][0].ToString());
//è®°å½ç¨æ·çsession["username"]å¼
Session["Username"] = ds.Tables["UserInfo"].Rows[0][1].ToString();
Response.Redirect("index.aspx");
}
else {
//å¦å ç¨æ·ååå¯ç é误 ç»äºæ示,è¿åä¸ä¸é¡µé¡µé¢
Response.Write("<script>alert('æ¨çç»å½æ误ï¼è¯·æ ¸å¯¹ååéæ°ç»å½ï¼');
location='javascript:history.go(-1)';</script>");
}
}
else {
//å¦å éªè¯ç ä¸æ£ç¡®ï¼è¿åä¸ä¸é¡µé¢
Response.Write("<script>alert('请æ£ç¡®è¾å ¥éªè¯ç ï¼');
location='javascript:history.go(-1)';</script>");
}
}
}