Asp.NetÖÐSession
Session¼´»á»°£¬ÊÇÖ¸Ò»¸öÓû§ÔÚÒ»¶Îʱ¼äÄÚ¶Ôijһ¸öÕ¾µãµÄÒ»´Î·ÃÎÊ¡£
Session¶ÔÏóÔÚ.NETÖжÔÓ¦HttpSessionStateÀ࣬±íʾ“»á»°×´Ì¬”£¬¿ÉÒÔ±£´æÓ뵱ǰÓû§»á»°Ïà¹ØµÄÐÅÏ¢¡£
Session¶ÔÏóÓÃÓÚ´æ´¢´ÓÒ»¸öÓû§¿ªÊ¼·ÃÎÊij¸öÌض¨µÄaspxµÄÒ³ÃæÆ𣬵½Óû§À뿪Ϊֹ£¬Ìض¨µÄÓû§»á»°ËùÐèÒªµÄÐÅÏ¢¡£Óû§ÔÚÓ¦ÓóÌÐòµÄÒ³ÃæÇл»Ê±£¬Session¶ÔÏóµÄ±äÁ¿²»»á±»Çå³ý¡£
¶ÔÓÚÒ»¸öWebÓ¦ÓóÌÐò¶øÑÔ£¬ËùÓÐÓû§·ÃÎʵ½µÄApplication¶ÔÏóµÄÄÚÈÝÊÇÍêÈ«Ò»ÑùµÄ£»¶ø²»Í¬Óû§»á»°·ÃÎʵ½µÄSession¶ÔÏóµÄÄÚÈÝÔò¸÷²»Ïàͬ¡£ Session¿ÉÒÔ±£´æ±äÁ¿£¬¸Ã±äÁ¿Ö»Äܹ©Ò»¸öÓû§Ê¹Óã¬Ò²¾ÍÊÇ˵£¬Ã¿Ò»¸öÍøÒ³ä¯ÀÀÕ߶¼ÓÐ×Ô¼ºµÄSession¶ÔÏó±äÁ¿£¬¼´Session¶ÔÏó¾ßÓÐΨһÐÔ¡£
£¨1£©½«ÐµÄÏîÌí¼Óµ½»á»°×´Ì¬ÖÐ
Óï·¨¸ñʽΪ£º
Session ("¼üÃû") = Öµ
»òÕß
Session.Add( "¼üÃû" , Öµ)
£¨2£©°´Ãû³Æ»ñÈ¡»á»°×´Ì¬ÖеÄÖµ
Óï·¨¸ñʽΪ£º
±äÁ¿ = Session ("¼üÃû")
»òÕß
±äÁ¿ = Session.Item("¼üÃû")
£¨3£©É¾³ý»á»°×´Ì¬¼¯ºÏÖеÄÏî
Óï·¨¸ñʽΪ£º
Session.Remove("¼üÃû")
£¨4£©Çå³ý»á»°×´Ì¬ÖеÄËùÓÐÖµ
Óï·¨¸ñʽΪ£º
Session.RemoveAll()
»òÕß
Session.Clear()
£¨5£©È¡Ïûµ±Ç°»á»°
Óï·¨¸ñʽΪ£º
Session.Abandon()
£¨6£©ÉèÖûỰ״̬µÄ³¬Ê±ÆÚÏÞ£¬ÒÔ·ÖÖÓΪµ¥Î»¡£
Óï·¨¸ñʽΪ£º
Session.TimeOut = ÊýÖµ
Global.asax ÎļþÖÐÓÐ2¸öʼþÓ¦ÓÃÓÚSession¶ÔÏó
ʼþÃû³Æ ˵Ã÷
Session_Start ÔڻỰÆô¶¯Ê±¼¤·¢
Session_End ÔڻỰ½áÊøʱ¼¤·¢
Ïà¹ØÎĵµ£º
//Á¬½ÓÊý¾Ý¿â
string myStr = CODE.DbHelperSQL.connectionString;
SqlConnection myConn = new SqlConnection(myStr);
myConn.Open();
&nbs ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryStrin ......
In the last post I showed how to use the ASP.NET 3.5 Routing Engine
for URLRewriting purposes. I want to go further in this post by adding
the ability to add variables into a route path and forward and append
query string variables to the destination Web Form request.
A route can contain one or ......
select top 6 * from ViewHouseSale where 1=1 and (EstateType='0' or EstateType='1')
and DateDiff(day,PubDate,getdate()) <=7 and IfBenefit='Y' and IfValid='Y' order by PubDate DESC
select top 6 * from ViewHouseSale where 1=1 and&nb ......
Ò»¡¢ÏìÓ¦Öض¨Ïò·½·¨
ÏìÓ¦Öض¨Ïò·½·¨ÊÇĿǰΪֹ½«Ò»¸öÍøÒ³Öض¨Ïòµ½ÁíÒ»¸öÍøÒ³µÄ×î¼òµ¥µÄ·½·¨µÄ×î¼òµ¥µÄ·½·¨¡£µ±Web·þÎñÆ÷½Óµ½Ò»¸öÖض¨ÏòÇëÇóºó£¬Ëü»á½«Ò»¸öÏìӦͷË͸ø¿Í»§¶Ë£¬Õ⽫µ¼Ö¿ͻ§¶Ë·¢ËÍÒ»¸öеÄÇëÇóµ½·þÎñÆ÷¡£°´¾ä»°Ëµ£¬Ò»¸öÖض¨ÏòÇëÇóʵ¼ÊÉÏÊÇÁ½¸öÇëÇóÏìÓ¦£ºÒ»¸öÊÇ×î³õµÄÇëÇóÏìÓ¦£¬ÁíÒ»¸öÊÇеÄÖض¨ÏòÇëÇóÏìÓ¦¡ ......