Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

CookieÓ¦ÓÃÍêÈ«½âÎö£¨Ò»£©£ºasp.netÖÐCookie¼¼Êõ

Cookie ÊÇʲô£¿
 
ÔÚasp.netÖУ¬ÈçºÎʹÓã¿
 
 
 
1   Cookie ÊÇʲô£¿
 
Cookie£ºµçÄÔÖмǼÓû§ÔÚÍøÂçÖеÄÐÐΪµÄÎļþ£»ÍøÕ¾¿Éͨ¹ýCookieÀ´Ê¶±ðÓû§ÊÇ·ñÔø¾­·ÃÎʹý¸ÃÍøÕ¾¡££¨Õª×Ô http://gb.cri.cn/17004/2007/03/08/121@1487554.htm£©
2ÔÚasp.netÖУ¬ÈçºÎʹÓã¿
 
 
ASP.NETͨ¹ýSystem.Web¿Õ¼äÃû³ÆÒ²ÌṩÁËcookieµÄ·ÃÎÊ¡£ËäÈ»Äã²»Ó¦¸ÃʹÓÃcookieÀ´´æ´¢Ò»Ð©Ãô¸ÐÐÔµÄÊý¾Ý£¬µ«ÊÇ£¬ËüÃÇÊÇ´¦ÀíËøϸÊý¾ÝµÄÒ»¸ö¼«ºÃµÄÑ¡Ôñ£¬±ÈÈçÑÕÉ«²ÎÊýÑ¡Ôñ»òÕß×îºóÒ»´Î·ÃÎÊÈÕÆÚ¡£
´«µÝcookies
cookieÊÇ´æ´¢ÔÚ¿Í»§¶Ë¼ÆËã»úµÄÒ»¸öСÎļþ¡£Èç¹ûÄãÊÇÒ»¸öWindowsÓû§£¬¿ÉÒÔÔÚÓû§Â·¾¶Öв鿴Cookies·¾¶£¬¼´ÎªDocuments And Settings·¾¶¡£Õâһ·¾¶°üº¬ÕâÒ»ÎļþÃû³ÆµÄÎı¾Îļþ£º
username @ Web site domain that created the cookie
(Óû§Ãû³Æ@½¨Á¢cookieµÄÕ¾µãÓòÃû)
.NET System.Web¿Õ¼äÃû³Æ°üº¬Èý¸öÀ࣬Äã¿ÉÒÔʹÓÃËüÃÇÀ´´¦Àí¿Í»§¶ËµÄCookies£º
HttpCookie£ºÌṩһ¸ö½¨Á¢ºÍ²Ù×÷¶ÀÁ¢HTTP cookiesµÄ°²È«ÀàÐ͵ķ½Ê½¡£
HttpResponse£ºCookiesÊôÐÔÔÊÐí²Ù×÷¿Í»§¶Ëcookies¡£
HttpRequest£ºCookiesÊôÐÔÔÊÐí·ÃÎÊ¿Í»§¶Ë²Ù×÷µÄcookies¡£
HttpResponseºÍHttpRequest¶ÔÏóµÄCookiesÊôÐÔ½«·µ»ØÒ»¸öHttpCookieCollection¶ÔÏó£¬Ëü°üº¬×Å£¬½«µ¥¶ÀµÄcookiesÌí¼Óµ½¼¯ºÏ(collection)ÖУ¬ÒÔ¼°´Ó¼¯ºÏ(collection)»ñµÃÒ»¸öµ¥¶ÀµÄcookies¡£
HttpCookieÀà
HttpCookieÀàÕë¶ÔÓÚ¿Í»§´æ´¢Ö®Óöø½¨Á¢µÄµ¥¶Àcookies¡£Ò»µ©HttpCookie¶ÔÏó±»½¨Á¢£¬Äã¿ÉÒÔ½«ÆäÌí¼Óµ½HttpResponse¶ÔÏóµÄCookiesÊôÐÔÖС£Í¬ÑùµÄ£¬Äã¿ÉÒÔͨ¹ýHttpRequest¶ÔÏó·ÃÎÊÏÖÓеÄcookies¡£HttpCookieÀà°üº¬ÒÔÏµĹ«ÓÐÊôÐÔ£º
Domain(ÓòÃû)£º»ñµÃ»òÉèÖÃÓëcookieÓйصÄÓòÃû£¬¿ÉÓÃÓÚÏÞÖÆÌض¨ÇøÓòµÄcookie·ÃÎÊ¡£
Expires(ÆÚÏÞ)£º»ñµÃ»òÉèÖÃcookieµÄÖÕÖ¹ÈÕÆÚºÍʱ¼ä£¬Äã¿ÉÒÔ½«ÆäÉèÖÃΪһ¸ö¹ýÈ¥µÄÈÕÆÚÒÔ×Ô¶¯ÖÕÖ¹»òÕßɾ³ýcookie¡£
Names(Ãû³Æ)£º»ñµÃ»òÉèÖÃcookieÃû³Æ¡£
Path(·¾¶)£º»ñµÃ»òÉèÖÃcookieµÄÐéÄâ·¾¶¡£ÕâÒ»ÊôÐÔÔÊÐíÄãÏÞÖÆcookie·¶Î§£¬Ò²¾ÍÊÇ˵£¬·ÃÎÊcookieÖ»ÄÜÏÞÖÆÓÚÒ»¸öÌض¨µÄÎļþ¼Ð»òÕß·¾¶¡£ÉèÖÃÕâÒ»ÊôÐÔÏÞÖÆΪֻÄÜ·ÃÎÊÌض¨Â·¾¶ºÍ¸Ã·¾¶ÏµÄËùÓÐÎļþ¡£
Secure(°²È«)£º·¢ÐźÅÒÔ±íʾÊÇ·ñʹÓÃSecure Sockets Layer (SSL)À´·¢ËÍcookieÖµ¡£
Value(Öµ)£º»ñµÃ»òÉèÖÃÒ»¸öµ¥¶ÀµÄcookieÖµ¡£
Values(ÐÅÏ¢)£º·µ»Ø°üº¬ÔÚcookieÖеÄkey/valueµÄÒ»¸ö¼¯ºÏ¡£
ʹÓÃÑùÀý£º
 


Ïà¹ØÎĵµ£º

¡¾asp.net¡¿´úÂëÖмâÀ¨ºÅºÍ°Ù·ÖºÅµÄº¬Òå

1¡¢<%=%> ÀïÃæ·ÅµÄ±äÁ¿Ãû£¬È磺
<div>
<h1>Hello World</h1>
<p>Welcome to Beginning ASP.NET 3.5 on <%=
DateTime.Now.ToString() %></p>
</div>
Êä³ö½á¹ûΪ£º
Hello World
Welcome to Beginning ASP.NET 3.5 on 2009-11-10 15:53:08
2¡¢ <%#%> ÕâÀïÊÇÊ ......

asp.netÒ³ÃæµÄ¼ÓÔØ˳Ðò

Ò³Ãæ¼ÓÔØ˳ÐòÈçÏÂ:
Page.Init
Page.Load
Textbox.TextChanged
Button.Click
Page.PreRender
Page.Unload
ÔÚPage.Unload֮ǰ,Ò³Ãæ¾Í³ÊÏÖ³öÀ´ÁË.
page.initÖ»ÊÇÔÚÒ³ÃæµÚÒ»´ÎÔØÈëµÄʱºòÖ´ÐÐ,µ±Ò³Ãæpostbackºó´Ópage.load¿ªÊ¼Ö´ÐÐ.
e.g
<%@ Page Language="C#" AutoEventWireup="true" CodeBe ......

asp.netʱ¼ä¸ñʽ´óÈ«

DateTime dt = DateTime.Now;
// Label1.Text = dt.ToString();//2005-11-5 13:21:25
// Label2.Text = dt.ToFileTime().ToString();//127756416859912816
// Label3.Text = dt.ToFileTimeUtc().ToString();//127756704859912816
// Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
// Label5.Text = ......

asp.netѧϰÍø

±¾ÎÄΪÖйúASP.NET¿ª·¢ÍøÔ­´´ÎÄÕ£¬×ªÔرØÐë×¢Ã÷³ö´¦¡£ Ãû³Æ£º ASP.NET
µØÖ·£ºhttp://www.asp.net
½éÉÜ£ºÎ¢Èí.NET webformµÄÀϳ²£¬×ÊÁϺÍʵÀý´úÂ붼·Ç³£Äѵá£
Ãû³Æ£º CSDNÎĵµÖÐÐÄ    loveswallow998  58213998
µØÖ·£ºhttp://dev.csdn.net/
½éÉÜ£ºÖÐÎĵģ¬×ÊÁÏ»¹Ëã·á¸»£¬¿ÉÒÔ×÷Ϊ¹úÄÚÊ×Ñ¡¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ