ASP.NETÖÐcookie¶Áд·½·¨½éÉÜ
Cookie (HttpCookieµÄʵÀý)ÌṩÁËÒ»ÖÖÔÚ Web Ó¦ÓóÌÐòÖд洢Óû§Ìض¨ÐÅÏ¢µÄ·½·¨¡£ÀýÈ磬µ±Óû§·ÃÎÊÄúµÄÕ¾µãʱ£¬Äú¿ÉÒÔʹÓÃCookie ´æ´¢Óû§Ê×Ñ¡Ïî»òÆäËûÐÅÏ¢¡£µ±¸ÃÓû§ÔٴηÃÎÊÄúµÄÍøվʱ£¬Ó¦ÓóÌÐò±ã¿ÉÒÔ¼ìË÷ÒÔÇ°´æ´¢µÄÐÅÏ¢¡£
ASP.NETÖеÄcookie£º´´½¨Cookie·½·¨ (1)
Response.Cookies["userName"].Value = “admin";
Response.Cookies[“userName”].Expires = DateTime.Now.AddDays(1);
//Èç¹û²»ÉèÖÃʧЧʱ¼ä,CookieÐÅÏ¢²»»áдµ½Óû§Ó²ÅÌ,ä¯ÀÀÆ÷¹Ø±Õ½«»á¶ªÆú¡£
ASP.NETÖеÄcookie£º´´½¨Cookie·½·¨ (2)
HttpCookie aCookie = new HttpCookie(“lastVisit”);
//ÉÏÒ»´Î·ÃÎÊʱ¼ä
aCookie.Value = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(aCookie);
ASP.NETÖеÄcookie£º·ÃÎÊCookie·½·¨(1)
if(Request.Cookies["userName"] != null)
Label1.Text = Server.HtmlEncode(Request.Cookies["userName"].Value);
·ÃÎÊCookie·½·¨(2)
if(Request.Cookies["userName"] != null) {
HttpCookie aCookie = Request.Cookies["userName"];
Label1.Text = Server.HtmlEncode(aCookie.Value);
}
ASP.NETÖеÄcookie£º´´½¨¶àÖµCookie·½·¨ (1)
Response.Cookies["userInfo"]["userName"] = “admin";
Response.Cookies["userInfo"]["lastVisit"] = DateTime.Now.ToString();
Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(1);
ASP.NETÖеÄcookie£º´´½¨¶àÖµCookie·½·¨ (2)
HttpCookie aCookie = new HttpCookie("userInfo");
aCookie.Values["userName"] = “admin";
aCookie.Values["lastVisit"] = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(aCookie);
ASP.NETÖеÄcookie£º¶ÁÈ¡¶àÖµCookie
HttpCookie aCookie = Request.Cookies["userInfo"];
string userName=aCookie.Values[“userName”];
string lastVisit=aCookie.Values[“lastVisit”];
ASP.NETÖеÄcookie£ºÐ޸ĺÍɾ³ýCookie
²»ÄÜÖ±½ÓÐ޸Ļòɾ³ýCookie£¬Ö»ÄÜ´´½¨Ò»¸öеÄCookie£¬·¢Ë͵½¿Í»§¶ËÒÔʵÏÖÐ޸Ļòɾ³ýCookie¡£
Ïà¹ØÎĵµ£º
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:Button ID="Button1" runat="server" Text="Ìí¼Ó¿ÕÐÐ" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="±£´æËùÓÐ" OnClick="Button2_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="403px">
......
1¡¢.NetµÄHTTPÇëÇó
.NETÓëASPµÄÔËÐлúÖÆÓкܴó²»Í¬.
ASPµÄÇëÇóÓëÏìÓ¦ÊÇ,ASPÒ³Ãæ±»ÇëÇó,È»ºóÖðÐнâÊÍ.ÊÇ»ùÓÚ¹ý³ÌµÄ.×î¶àÊÇ°üº¬ÁËÎļþ,ÐèÒªÏÈÒýÈëÎļþ°ÕÁË.
¶ø.Net,ÔÚÒ³Ãæ±»ÇëÇóºó,Ê×ÏÈÊǼÓÔØHTTP Module,Õâ²»ÊDZ¾ÎĵÄÖصã.È»ºóÔÙ¼ÓÔØHTTP
Handler.ÕâÒ²²»ÊDZ¾ÎĵÄÖصã.¼ÓÔصÄÕâÁ½Ïî,¶¼ÐèÒªÔÚWebconfigÎļþÖÐÅäÖÃ.´ó¼ÒÖªµÀ ......
½ñÌìÎÒÃǼÌÐøÍê³É Õâ¸ö MVC2 ¼òµ¥ÊµÀýµÄÊ£Ó๦ÄÜ£ºÏÔʾÃ÷ϸ¡¢Ìí¼Ó¡¢±à¼µÈ¡£¡£¡£¡£¡£
Ò»¡¢ÏÔʾÃ÷ϸ
¡¡¡¡ÔÚ MoviewsControllerÖÐµÄ Details·½·¨Àï ÓÒ¼ü--Add view£¬´´½¨Ò»¸öÇ¿ÀàÐ͵ÄÊÓͼ
¡¡¡¡
¡¡¡¡
È·¶¨ºó£¬Õâ¸öÃ÷ϸµÄÊÓͼÎļþ¾ÍÒѾÉú³É¡£¡£¡£
´Ëʱ£¬ÎÒÃÇÐèÒªÐÞ¸Ä Detials ·½·¨£¬¸ù¾Ý ´«µÝ¹ýÀ´µÄ id²ÎÊý£¬È¥Êý¾Ý¿â²éÑ ......
ÔÚ¹¤¾ßÏäÖÐÌí¼ÓÑ¡Ïî Ìí¼Ócom×é¼þ ÕÒµ½ocxÎļþ
È»ºó ÉèÖÃÄã×öµÄÍøÒ³µÄ Ãû×Ö ÔÚä¯ÀÀÆ÷ÖÐµÄ ¹¤¾ß>IEÑ¡Ïî>°²È«>¿ÉÐÅÈÎÕ¾µã
<body>
<object id="VpOcx" classid="clsid:8B832F98-B7EE-4E2B-9FB4-86FA3BA17047"
codebase="~/../Bin/VpMatrixOcxPro.ocx"
&nbs ......
AJAXµÄ·ÖÒ³£¬ÊµÏÖ˼·ÊÇ£º
¡¡¡¡1.ÀûÓÃ$.fn.extendÔÚJQuery¿ò¼ÜÏÂÀ©Õ¹pagerÀà
¡¡¡¡2.½«»ñÈ¡¼Ç¼×ÜÊýÓëÏàÓ¦Ò³¼Ç¼µÄºǫ́·½·¨£¬Ð´Ôڼ̳Ð×ÔIHttpHandlerÀàµÄHandler.ashx.csÀ࣬µ±È»Êµ¼ÊÉÏÓÃaspx.csÎļþдºǫ́·½·¨Ò²Ã»ÎÊÌ⣬µ«ÓÉÓÚ.ashx.csÎļþÎÞÐè´¦ÀíÒ³ÃæÖî¶àʼþÒò¶øЧÂʸü¸ß¡£
¡¡¡¡3.ÔÚ³ÊÏÖÒ³ÃæÉϼÓÔØpagerÀà
¡¡ ......