ASP.NETÖÐCookieµÄÓ÷¨
CookieΪ¿Í»§¶ËÐÅÏ¢´æ·Å¶ÔÏ󣬿ÉÒÔ°ÑÓû§µÄÐÅÏ¢±£´æÔÚÓû§±¾µØ£¬²»±Ø×ÜÊÇ·ÃÎÊ·þÎñÆ÷
ÓëSession²»Í¬£¬SessionΪÓû§È«¾Ö±äÁ¿£¬¶ÔÓÚ¸ÃÓû§µÄËùÓвÙ×÷¹ý³Ì¶¼ÓÐЧ¡£
//1¡£´´½¨Cookie¶ÔÏó
HttpCookie newCookie = new HttpCookie("User");
//2¡£CookieÖÐÌí¼ÓÐÅÏ¢ÏΪ¼üÖµ¶Ô£¬key/value
newCookie.Values.Add("Name",tbUserName.Text.Trim());
newCookie.Values.Add("Psd",tbUserPsd.Text.Trim());
//3¡£Èç¹û²»ÉèÖÃExpiresÊôÐÔ£¬¼´ÎªÁÙʱCookie£¬ä¯ÀÀÆ÷¹Ø±Õ¼´Ïûʧ
newCookie.Expires = DateTime.Now.AddDays(1); //ÉèÖùýÆÚÌìÊýΪ1Ìì
//4¡£Ð´ÈëCookies¼¯ºÏ
Response.AppendCookie(newCookie);
//5¡£Í¨¹ýRequest¶ÔÏó¶ÁÈ¡µÃµ½Cookies¶ÔÏó
HttpCookie newCookie = Request.Cookies["User"];
È»ºónewCookie["Name"].values.ToString()
newCookie["Psd"].Values.ToString() ·ÃÎʸÃCookie¶ÔÏóµÄÔªËØ
//6¡£Í¨¹ýResponse¶ÔÏóдÈë¿Í»§¶ËµÄCookie
newCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(newCookie);
Ïà¹ØÎĵµ£º
ÔÚASP.Net MVCÀàÐ͵ÄÏîÄ¿ÖÐÓÒ»÷Controller Îļþ¼Ð£¬Ñ¡ÖÐAdd=>Controller¡ºó£¬»áÔÚн¨µÄController ÖвåÈëһЩĬÈÏ´úÂë¡£ ÔÚController µÄ¸÷¸öAction·½·¨ÖÐÓÒ»÷ Add View¡£¬Ò²»áÔÚн¨µÄViewÖвåÈëһЩ´úÂë¡£ÔÚн¨Viewʱ²åÈëµÄ´úÂë»á¸ù¾ÝÉÏÏÂÎĺÍÄãµÄÑ¡Ôñ¶ø²»Í¬£¬ËƺõÓкܴóµÄ´úÂëÉú³É¹¦ÄÜ¡£ ÉÏÊöÁ½ÕßÉú³É´ ......
ÕªÒª
±¾ÎĽ«Ê×ÏȽéÉÜÒ»ÏÂÎÄÕµÄд×÷±³¾°ºÍÓõ½µÄÏà¹Ø¼¼Êõ¡£È»ºó½«·Ö±ðʹÓÃÆÓËصÄAjax¼¼ÊõºÍASP.NET AJAX¿ò¼Ü·Ö±ðʵÏÖ¾µäµÄ“Hello£¡XX”£¬Í¨¹ýÁ½¸öСÀý×Ó£¬Ê¹ÅóÓÑÃǶÔÕâ¸ö¿ò¼ÜµÄÌصãºÍ¿ò¼ÜµÄʹÓ÷½·¨ÓÐÒ»¸ö³õ²½µÄÈÏʶ¡£
Ç°ÑÔ
ÎÒÏ룬Èç¹û½ñÌìÄ ......
Ê×ÏÈÏÈÖØÎÂһϹØÓÚb/sģʽµÄÕû¸öÇëÇó¹ý³Ì:
¿Í»§¶Ëͨ¹ýÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÇÃÈëµØÖ·À´·¢ËÍÇëÇóµ½·þÎñÆ÷¶Ë -> ·þÎñÆ÷½ÓÊÕµ½ÇëÇóÖ®ºó£¬·¢¸øÏàÓ¦µÄ·þÎñÆ÷¶ËÒ³Ã棨Ҳ¾ÍÊǽű¾£©À´Ö´ÐУ¬½Å±¾²úÉú¿Í»§¶ËµÄÏìÓ¦£¬·¢Ëͻؿͻ§¶Ë -> ¿Í»§¶Ëä¯ÀÀÆ÷½ÓÊÕµ½·þÎñÆ÷´«»ØµÄÏìÓ¦£¬¶ÔHtml½øÐ ......
ʲôÊÇLINQ?
LINQÊÇÓïÑÔ¼¯³É²éѯ(Language Integrated Query)µÄ¼ò³Æ£¬ÊÇVisual Studio 2008 ºÍ.NET Framework 3.5 °æÖÐÒ»Ïî,Í»ÆÆÐԵĴ´Ð£¬ËüÔÚ¶ÔÏóÁìÓòºÍÊý¾ÝÁìÓòÖ®¼ä¼ÜÆðÁËÒ»×ùÇÅÁº.
Ò»¸ö¼òµ¥LINQ²éѯ£º
&n ......