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 ÔڻỰ½áÊøʱ¼¤·¢
Ïà¹ØÎĵµ£º
ÏÈ¿´¿´ASP.NETÒ³ÃæˢеÄʵÏÖ·½·¨£º
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); }
µ ......
-----MD5¼ÓÃÜ
//ʹÓüÓÃÜ·þÎñÌṩ³ÌÐò(CSP) ÌṩµÄʵÏÖ£¬¼ÆËãÊäÈëÊý¾ÝµÄMD5 ¹þÏ£Öµ
MD5CryptoServiceProvider crypto = new MD5CryptoServiceProvider();
//½«×Ö·û´®× ......
ÏÈ¿´¿´ASP.NETÒ³ÃæˢеÄʵÏÖ·½·¨£º
µÚÒ»£º
C# code
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
µÚ¶þ£º
C# code
private void Button2_Click( object sender, System.EventArgs e )
{
Response.Write( " < script langua ......
1.
ÓйØÓÚURLµÄÖØд£¬±¾ÎÄÒ²Ö»ÊÇÄÃÀ´Ö÷Òâ¡£Ïà¼ÌÓÐMSµÄ×é¼þ“URLRewriter”ºÍÔÚGlobal.asaxÀïµÄ“Application_BeginRequest()”±àÂ뷽ʽ£¬ÒÔ¼°IISÀïµÄISAPIÉèÖá£
ÄÈÁÐÏÂÀ´£¬ÊµÏÖ·½·¨Ò²¶¼ºÜ¼òµ¥¡£
·½·¨Ò»£ºMS×é¼þ
ÕâÀïÒ²²»ÓÃÏê½âÁË£¬Ïà¹ØÇë¿´£º
http://www.microsoft.com/china/msdn/libra ......