ÎÂܰÌáʾ£º´úÂëÔÚÏßä¯ÀÀ¹¦ÄÜÖ»ÄÜ×öΪԴÂëä¯ÀÀ²Î¿¼£¬²»ÄÜչʾÏîÄ¿µÄÈ«²¿£¬Èç¹ûÏë¸ü½øÒ»²½Á˽â¸Ã´úÂëÇëÏÂÔØ£ºXMLͬѧ¼ϵͳԴÂ루±ÏÒµÉè¼Æ£©
µ±Ç°Îļþ·¾¶£ºXMLClassBooks/Default.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Web; 5
using System.Web.Security; 6
using System.Web.UI; 7
using System.Web.UI.WebControls; 8
using System.Web.UI.WebControls.WebParts; 9
using System.Web.UI.HtmlControls; 10
11
public partial class _Default : System.Web.UI.Page 12
{ 13
protected void Page_Load(object sender, EventArgs e) 14
{ 15
if (!IsPostBack) 16
{ 17
//¶ÁÈ¡CookieÀïµÄÕʺźÍÃÜÂë 18
HttpCookie cookie = Request.Cookies["userInfo"]; 19
if (cookie != null) 20
{ 21
this.userLogin.InnerHtml = "<p>" + cookie.Values["userName"].ToString() + " ͬѧ£¬»¶ÓÄã»ØÀ´ !<br/><br/><a href='index.aspx'>½øÈëÎÒµÄͬѧ¼</a></p>"; 22
} 23
} 24
} 25
26
//³ÉÔ±µÇ¼ 27
protected void btnLogin_Click(object sender, EventArgs e) 28
{ 29
if (IsValid) 30
{ 31
string _userName = this.txtUserName.Text.Trim(); 32
string _userPwd = this.txtUserPwd.Text.Trim(); 33
34
//Cookie´æ·Åʱ¼ä 35
int _cookieDay = 0; 36
if (this.cookieYes.Checked) 37
_cookieDay = 14; //±£´æCookie 38
else 39
_cookieDay = 0; //²»±£´æCookie 40
Logic lg = new Logic(); //´´½¨LogicÀà¶ÔÏó 41
if (lg.UserLogin(_userName, _userPwd, _cookieDay)) //µ÷ÓÃÑéÖ¤·½·¨ 42
Response.Redirect("index.aspx"); 43
else 44
lg.Msg("ÕʺŻòÃÜÂë´íÎó!"); 45
} 46
} 47
} 48





}
}