asp.netÖлùÓÚFormÑéÖ¤µÄ½ÇÉ«ÊÚȨÑéÖ¤
ÒÔÏÂÀàÈÝΪתÔØ£¬µ«ÊDz»ÖªµÀÊÇʲôÔÒò£¬¾±¾È˲âÊÔÕâ¸ö·½·¨ÓÐÒ»¸öbug£¬°´ÕÕÒÔÏÂÀàÈÝËùÉè¼ÆµÄ½ÇÉ«ÑéÖ¤²»Äܳɹ¦¡£Application_AuthorizeRequestʼþ¸ÄΪApplication_AuthenticateRequestʼþ²ÅÄÜʵÏÖ¡£
Asp.netµÄÉí·ÝÑéÖ¤ÓÐÓÐÈýÖÖ£¬·Ö±ðÊÇ"Windows | Forms | Passport"£¬ÆäÖÐÓÖÒÔFormsÑéÖ¤ÓõÄ×î¶à£¬Ò²×îÁé»î¡£
Forms ÑéÖ¤·½Ê½¶Ô»ùÓÚÓû§µÄÑéÖ¤ÊÚȨÌṩÁ˺ܺõÄÖ§³Ö£¬¿ÉÒÔͨ¹ýÒ»¸öµÇ¼ҳÃæÑéÖ¤Óû§µÄÉí·Ý£¬½«´ËÓû§µÄÉí·Ý·¢»Øµ½¿Í»§¶ËµÄCookie£¬Ö®ºó´ËÓû§ÔÙ·ÃÎÊÕâ¸öwebÓ¦ÓþͻáÁ¬Í¬Õâ¸öÉí·ÝCookieÒ»Æð·¢Ë͵½·þÎñ¶Ë¡£·þÎñ¶ËÉϵÄÊÚȨÉèÖþͿÉÒÔ¸ù¾Ý²»Í¬Ä¿Â¼¶Ô²»Í¬Óû§µÄ·ÃÎÊÊÚȨ½øÐпØÖÆÁË¡£
ÎÊÌâÀ´ÁË£¬ÔÚʵ¼ÊÊÇÓÃÖÐÎÒÃÇÍùÍùÐèÒªµÄÊÇ»ùÓÚ½ÇÉ«£¬»òÕß˵»ùÓÚÓû§×éµÄÑéÖ¤ºÍÊÚȨ¡£¶ÔÒ»¸öÍøÕ¾À´Ëµ£¬Ò»°ãµÄÑéÖ¤ÊÚȨµÄģʽӦ¸ÃÊÇÕâÑùµÄ£º¸ù¾Ýʵ¼ÊÐèÇó°ÑÓû§·Ö³É²»Í¬µÄÉí·Ý£¬¾ÍÊǽÇÉ«£¬»òÕß˵ÊÇÓû§×飬ÑéÖ¤¹ý³Ì²»µ«ÒªÑéÖ¤Õâ¸öÓû§±¾ÉíµÄÉí·Ý£¬»¹ÒªÑéÖ¤ËüÊÇÊôÓÚÄĸö½ÇÉ«µÄ¡£¶ø·ÃÎÊÊÚȨÊǸù¾Ý½ÇÉ«À´ÉèÖõģ¬Ä³Ð©½ÇÉ«¿ÉÒÔ·ÃÎÊÄÄЩ×ÊÔ´£¬²»¿ÉÒÔ·ÃÎÊÄÄЩ×ÊÔ´µÈµÈ¡£ÒªÊÇ»ùÓÚÓû§À´ÊÚȨ·ÃÎʽ«»áÊǸöºÜ²»Êµ¼ÊµÄ×ö·¨£¬Óû§Óкܶ࣬»¹¿ÉÄÜËæʱµÄÔö¼õ£¬²»¿ÉÄÜÔÚÅäÖÃÎļþÖÐËæʱµÄΪ²»¶ÏÔö¼ÓµÄÐÂÓû§È¥Ôö¼Ó·ÃÎÊÊÚȨµÄ¡£
ÏÂÃæ´ó¸ÅµÄ¿´Ò»ÏÂFormsµÄ¹ý³Ì¡£
FormsÉí·ÝÑéÖ¤»ù±¾ÔÀí£º
Ò» Éí·ÝÑéÖ¤
Òª²ÉÓÃFormsÉí·ÝÑéÖ¤£¬ÏÈÒªÔÚÓ¦ÓóÌÐò¸ùĿ¼ÖеÄWeb.configÖÐ×öÏàÓ¦µÄÉèÖÃ:
<authentication mode="forms">
<forms name=".ASPXAUTH " loginUrl="/login.aspx" timeout="30" path= "/">
</forms>
</authentication>
ÆäÖÐ<authentication mode= "forms"> ±íʾ±¾Ó¦ÓóÌÐò²ÉÓÃFormsÑéÖ¤·½Ê½¡£
1. <forms>±êÇ©ÖеÄname±íʾָ¶¨ÒªÓÃÓÚÉí·ÝÑéÖ¤µÄ HTTP Cookie¡£Ä¬ÈÏÇé¿öÏ£¬name µÄÖµÊÇ .ASPXAUTH¡£²ÉÓôËÖÖ·½Ê½ÑéÖ¤Óû§ºó,ÒÔ´ËÓû§µÄÐÅÏ¢½¨Á¢Ò»¸öFormsAuthenticationTicketÀàÐ͵ÄÉí·ÝÑé֤Ʊ,ÔÙ¼ÓÃÜÐòÁл¯ÎªÒ»¸ö×Ö·û´®,×îºó½«Õâ¸ö×Ö·û´®Ð´µ½¿Í»§¶ËµÄnameÖ¸¶¨Ãû×ÖµÄCookieÖÐ.Ò»µ©Õâ¸öCookieдµ½¿Í»§¶Ëºó,´ËÓû§ÔٴηÃÎÊÕâ¸öwebÓ¦ÓÃʱ»á½«Á¬Í¬CookieÒ»Æð·¢Ë͵½·þÎñ¶Ë,·þÎñ¶Ë½«»áÖªµÀ´ËÓû§ÊÇÒѾÑéÖ¤¹ýµÄ.
ÔÙ¿´Ò»ÏÂÉí·ÝÑé֤Ʊ¶¼°üº¬ÄÄЩÐÅÏ¢ÄØ,ÎÒÃÇ¿´Ò»ÏÂFormsAuthenticationTicketÀà:
CookiePath£º ·µ»Ø·¢³ö Cookie µÄ·¾¶¡£×¢Ò⣬´°ÌåµÄ·¾¶ÉèÖÃΪ /¡£ÓÉÓÚ´°ÌåÇø·Ö´óСд£¬ÕâÊÇΪÁË·ÀÖ
Ïà¹ØÎĵµ£º
½üÆÚÓöµ½asp.net mvc »·¾³ÅäÖÃÎÊÌ⣬ËäÈ»¶¼°²×°ÉÏÈ¥ÁË£¬µ«ÊÇÔÚ´´½¨ADO.net ʵÌåÊý¾ÝÄ£ÐÍÍê³Éºó£¬»áÆÈʹvs´°¿Ú¹Ø±Õ£¬µ±ÄãÖØдò¿ªºó·¢ÏÖmodelsÎļþÖÐʲôҲûÓУ¬µ«ÊÇÔÚÏîÄ¿ËùÔÚµÄλÖã¬modelsÖÐÓÐÄã¸Õ½¨µÄʵÌåÊý¾ÝÄ£ÐÍ£¬¿ì°ÑÎÒÓôÃÆËÀÁË£¡Õâµ½µ×ÊÇÔõô»ØÊ£¿
ÎÒÓõÄÊÇVS2008 ¼òÌåÖÐÎÄרҵ°æ
AspNetMVC 1.0
vs2008 s ......
´óѧÉú»î£¬ºÜÄÑ˵£¬¸÷ÖÖÌå»áºÍ×Ì棬ÒòÈ˶øÒì
´óѧѧϰ£¬¸üÄÑ˵£¬¸÷Öֳɼ¨ºÍϹ»ì£¬¸÷ÓÐǧÇï
ºÜ¶àʱºò×ÜÊÇÔÚÏ룬ÕâЩÄêÀ´µ½µ×ѧµ½ÁËʲô£¬×÷Ϊһ¸ö´óѧÉú£¬±ÈÆðÄÇЩÉç»áÉϵĻì»ìµ½µ×ÓÐʲôÓÅÊÆ¡£Ã»Óд𰸣¬ÖÁÉÙÏÖÔÚûÓÐ
ºÜ¶àʱºò¶Ôѧϰ³äÂúÏ£Íû£¬µ«Äǽö½öÖ»ÊÇÍ£ÁôÔÚÄÔº£Öеļƻ®£¬¼¸ºõûÓйýʵÏÖ¡£
´óѧµÄ»ù´¡¿ÎºÜÖØÒª£¬ ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OracleClient;//ÒýÈëÃüÃû¿Õ¼ä ......
1¡¢Èç¹ûÕâÖÖÇé¿ö³öÏÖÔÚ±¾»ú£¬ÔòÔÚsql server µÄÆóÒµ¹ÜÀíÆ÷µÄ¿ØÖÆ̨Ŀ¼ÀïÑ¡ÔñÏàÓ¦µÄÊý¾Ý¿â£¬ÔÚÆäϵÄÓû§½ÚµãµãÓÒ¼üн¨Êý¾Ý¿âÓû§£¬½«***\ASPNETÓû§¼ÓÈ룬²¢¸³ÓèpublicȨÏÞ¡£
2¡¢Èç¹û³öÏÖÔÚÆäËûµÄµçÄÔ£¬Ôò¼ì²é ³ÌÐòÁ¬½ÓSQLServerµÄÁ¬½Ó×Ö·û´®ÊDz»ÊÇÓÃÁËwindows¼¯³ÉµÇ½£¬Ò»°ã³öÏÖ´ËÎÊÌâµÄ×´¿ö¶¼ÊÇÒòΪʹÓÃÁËwindows¼¯³Éµ ......
ÎÊÌ⣺
1ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
½â´ð£º
ÎÊÌâ1¡¢ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
´ð°¸ÈçÏ£º
javaScriptº¯ÊýÖÐÖ´ÐÐC#´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbut ......