½ÌÄãÈçºÎʵÏÖASP.NETÖÐÍøÕ¾·ÃÎÊÁ¿µÄͳ¼Æ
ÏÂÃæ½éÉÜÈçºÎ½øÐÐASP.NETÖÐÍøÕ¾·ÃÎÊÁ¿µÄͳ¼Æ¡£
Ò»¡¢½¨Á¢Ò»¸öÊý¾Ý±íIPStatÓÃÓÚ´æ·ÅÓû§ÐÅÏ¢
ÎÒÔÚIPStat±íÖдæ·ÅµÄÓû§ÐÅÏ¢Ö»°üÀ¨µÇ¼Óû§µÄIP£¨IP_Address£©£¬IPÀ´Ô´£¨IP_Src£©ºÍµÇ¼ʱ¼ä£¨IP_DateTime£©£¬Ð©±íµÄÐÅÏ¢±¾ÈËÖ»±£´æÒ»ÌìµÄÐÅÏ¢£¬Èç¹ûҪͳ¼Æÿ¸öÔµÄÐÅÏ¢ÔòÒª±£´æÒ»¸öÔ¡£
¶þ¡¢ÔÚGlobal.asaxÖлñÈ¡Óû§ÐÅÏ¢
ÔÚGlobal.asaxµÄSession_Start¼´Ð»ỰÆôÓÃʱ»ñÈ¡ÓйصÄÐÅÏ¢£¬Í¬Ê±ÔÚÕâÀïʵÏÖÔÚÏßÈËÊý¡¢·ÃÎÊ×ÜÈËÊýµÄÔöÁ¿Í³¼Æ£¬´úÂëÈçÏ£º
void Session_Start(object sender, EventArgs e) {
//»ñÈ¡·ÃÎÊÕßµÄIP
string ipAddress = Request.ServerVariables["REMOTE_ADDR"];
//»ñÈ¡·ÃÎÊÕßµÄÀ´Ô´
string ipSrc;
//ÅжÏÊÇ·ñ´ÓËÑË÷ÒýÇæµ¼º½¹ýÀ´µÄ
if (Request.UrlReferrer == null) {
ipSrc = "";
}
else {
//»ñÈ¡À´Ô´µØÖ·
ipSrc = Request.UrlReferrer.ToString();
}
//»ñÈ¡·ÃÎÊʱ¼ä
DateTime ipDatetime = DateTime.Now;
//±£´æIPÐÅÏ¢µ½Êý¾Ý¿âÖÐ
IPControl cont = new IPControl();
cont.AddIP(ipAddress, ipSrc, ipDatetime);
//»ñÈ¡Óû§·ÃÎʵÄÒ³Ãæ
string pageurl = Request.Url.ToString();
//ÅжϷÃÎʵÄÊÇ·ñÊÇĬÈÏÒ³
if (pageurl.EndsWith("IPStat.ASPx")) {
//Ëø¶¨±äÁ¿
Application.Lock();
//ΪҳÃæ·ÃÎÊÁ¿+1
Application["StatCount"] = int.Parse(Application["StatCount"].ToString()) + 1;
//½âËø
Application.UnLock();
}
//Ëø¶¨±äÁ¿
Session.Timeout = 10;
//É趨³¬Ê±Îª10·ÖÖÓ
Application.Lock();
Application["countSession"] = Convert.ToInt32(Application["countSession"]) + 1;
//·ÃÎÊ×ÜÈËÊý£«£±
Application["onlineWhx"] = (int)Application["onlineWhx"] + 1;
//ÔÚÏßÈËÊý¼Ó£«£±
Session["login_name"] = null;
//½âËø
Application.UnLock();
}
ÌáÐÑÒ»¾ä£¬±ðÍüÁËÏÂÃæµÄ´úÂ룬ÒÔʵÏÖÔÚÓû§ÀëÏßʱ£¬½«ÔÚÏßÈËÊý¼õÈ¥1¡£
void Session_End(object sender, EventArgs e) {
// ÔڻỰ½áÊøʱÔËÐеĴúÂë¡£
// ×¢Òâ: Ö»ÓÐÔÚ Web.config ÎļþÖÐµÄ sessionstate ģʽÉèÖÃΪ InProc ʱ£¬
²Å»áÒý·¢ Session_End ʼþ¡£
Èç¹û»á»°Ä£Ê½ÉèÖÃΪ StateServer
// »ò SQLServer£¬Ôò²»»áÒý·¢¸Ãʼþ¡£
//Ëø¶¨±äÁ¿
Application.Lock();
Application["onlineWhx"] = (int)Application["onlineWhx"] - 1;
//ÔÚÏßÈËÊý¼õ££±
Session["login
Ïà¹ØÎĵµ£º
Asp.Net¼¼Êõѧϰ˳ÐòÎÊÌâ
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
µÚÒ»²½:ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C££»òVB.NET¡£
ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó£¨OO£©ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ²»ÏÂÈ¥£¡
µÚ¶þ²½ ......
CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þΪÓû§ÌṩÁËÒ»ÖÖÖ¸¶¨ÊÇ/·ñ£¨Õæ/¼Ù£©Ñ¡ÔñµÄ·½·¨¡£
Ò»¡¢¹¦ÄÜ
¿ÉÒÔʹÓà CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þÖ´ÐÐÒÔϲÙ×÷£º
·µ±Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ½«ÒýÆðÒ³»Ø·¢¡£
·µ±Óû§Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ²¶»ñÓû§½»»¥¡£
·½«Ã¿¸ö¸´Ñ¡¿ò°ó¶ ......
ÔÚweb¿ª·¢Ê±£¬ÓеÄϵͳҪÇóͬһ¸öÓû§ÔÚͬһʱ¼äÖ»ÄܵǼһ´Î£¬Ò²¾ÍÊÇÈç¹ûÒ»¸öÓû§ÒѾµÇ¼ÁË£¬ÔÚÍ˳ö֮ǰÈç¹ûÔٴεǼµÄ»°ÐèÒª±¨´í¡£
¡¡¡¡³£¼ûµÄ´¦Àí·½·¨ÊÇ£¬ÔÚÓû§µÇ¼ʱ£¬ÅжϴËÓû§ÊÇ·ñÒѾÔÚApplicationÖдæÔÚ£¬Èç¹û´æÔھͱ¨´í£¬²»´æÔڵĻ°¾Í¼Óµ½ApplicationÖÐ(ApplicationÊÇËùÓÐSession¹²Óеģ¬Õû¸öwebÓ¦ÓÃ³Ì ......
ËÄ¡¢ÈçºÎ£ºÏìÓ¦Áбí Web ·þÎñÆ÷¿Ø¼þÖеĸü¸Ä
±¾Ö÷ÌâÖеÄÐÅÏ¢ÊÊÓÃÓÚÈçÏÂÁбí Web ·þÎñÆ÷¿Ø¼þ£ºListBox¡¢DropDownList¡¢CheckBoxList ºÍ RadioButtonList¡£
µ±Óû§ÔÚÁбí Web ·þÎñÆ÷¿Ø¼þÖнøÐÐÑ¡Ôñʱ£¬¿Ø¼þ½«Òý·¢Ò»¸öʼþ£¬Äú¿ÉÒÔÖ±½Ó¶Ô¸Ãʼþ×ö³öÏìÓ¦¡£Í¨³£¸ù±¾²»ÐèÒªÖ±½Ó¶ÔÑ¡Ôñʼþ½øÐÐÏì ......
21. Ö»ÔÚ±ØҪʱ±£´æ·þÎñÆ÷¿Ø¼þÊÓͼ״̬ ¡¡¡¡
×Ô¶¯ÊÓͼ״̬¹ÜÀíÊÇ·þÎñÆ÷¿Ø¼þµÄ¹¦ÄÜ£¬¸Ã¹¦ÄÜʹ·þÎñÆ÷¿Ø¼þ¿ÉÒÔÔÚÍù·µ¹ý³ÌÉÏÖØÐÂÌî³äËüÃǵÄÊôÐÔÖµ(Äú²»ÐèÒª±àдÈκδúÂë)¡£µ«ÊÇ£¬ÒòΪ·þÎñÆ÷¿Ø¼þµÄÊÓͼ״̬ÔÚÒþ²ØµÄ´°Ìå×Ö¶ÎÖÐÍù·µÓÚ·þÎñÆ÷£¬ËùÒԸù¦ÄÜȷʵ»á¶ÔÐÔÄܲúÉúÓ°Ïì¡£ÄúÓ¦¸ÃÖªµÀÔÚÄÄЩÇé¿öÏÂÊÓͼ״̬»áÓÐËù°ïÖú£¬ÔÚÄÄÐ ......