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

ASP.NETÀïµÄSessionÏêϸ½âÊÍ

SessionÄ£Ðͼò½é
SessionÊÇʲôÄØ£¿¼òµ¥À´Ëµ¾ÍÊÇ·þÎñÆ÷¸ø¿Í»§¶ËµÄÒ»¸ö±àºÅ¡£µ±Ò»Ì¨WWW·þÎñÆ÷ÔËÐÐʱ£¬¿ÉÄÜÓÐÈô¸É¸öÓû§ä¯ÀÀÕýÔÚÔËÕýÔÚÕą̂·þÎñÆ÷ÉϵÄÍøÕ¾¡£µ±Ã¿¸öÓû§Ê×´ÎÓëÕą̂WWW·þÎñÆ÷½¨Á¢Á¬½Óʱ£¬Ëû¾ÍÓëÕâ¸ö·þÎñÆ÷½¨Á¢ÁËÒ»¸öSession£¬Í¬Ê±·þÎñÆ÷»á×Ô¶¯ÎªÆä·ÖÅäÒ»¸öSessionID£¬ÓÃÒÔ±êʶÕâ¸öÓû§µÄΨһÉí·Ý¡£Õâ¸öSessionIDÊÇÓÉWWW·þÎñÆ÷Ëæ»ú²úÉúµÄÒ»¸öÓÉ24¸ö×Ö·û×é³ÉµÄ×Ö·û´®£¬ÎÒÃÇ»áÔÚÏÂÃæµÄʵÑéÖмûµ½ËüµÄʵ¼ÊÑù×Ó¡£
Õâ¸öΨһµÄSessionIDÊÇÓкܴóµÄʵ¼ÊÒâÒåµÄ¡£µ±Ò»¸öÓû§Ìá½»ÁË±íµ¥Ê±£¬ä¯ÀÀÆ÷»á½«Óû§µÄSessionID×Ô¶¯¸½¼ÓÔÚHTTPÍ·ÐÅÏ¢ÖУ¬£¨ÕâÊÇä¯ÀÀÆ÷µÄ×Ô¶¯¹¦ÄÜ£¬Óû§²»»á²ì¾õµ½£©£¬µ±·þÎñÆ÷´¦ÀíÍêÕâ¸ö±íµ¥ºó£¬½«½á¹û·µ»Ø¸øSessionIDËù¶ÔÓ¦µÄÓû§¡£ÊÔÏ룬Èç¹ûûÓÐSessionID£¬µ±ÓÐÁ½¸öÓû§Í¬Ê±½øÐÐ×¢²áʱ£¬·þÎñÆ÷ÔõÑù²ÅÄÜÖªµÀµ½µ×ÊÇÄĸöÓû§Ìá½»ÁËÄĸö±íµ¥ÄØ¡£µ±È»£¬SessionID»¹ÓкܶàÆäËûµÄ×÷Óã¬ÎÒÃÇ»áÔÚºóÃæÌá¼°µ½¡£
³ýÁËSessionID£¬ÔÚÿ¸öSessionÖл¹°üº¬ºÜ¶àÆäËûÐÅÏ¢¡£µ«ÊǶÔÓÚ±àдASP»òASP.NETµÄ³ÌÐòÓëÀ´Ëµ£¬×îÓÐÓõĻ¹ÊÇ¿ÉÒÔͨ¹ý·ÃÎÊASP/ASP.NETµÄÄÚÖÃSession¶ÔÏó£¬ÎªÃ¿¸öÓû§´æ´¢¸÷×ÔµÄÐÅÏ¢¡£ÀýÈçÎÒÃÇÏëÁ˽âһϷÃÎÊÎÒÃÇÍøÕ¾µÄÓû§ä¯ÀÀÁ˼¸¸öÒ³Ã棬ÎÒÃÇ¿ÉÄÜÔÚÓû§¿ÉÄÜ·ÃÎʵ½Ã¿¸öµÄÒ³ÃæÖмÓÈ룺
<%
If Session("PageViewed") = ""Then
Session("PageViewed") = 1
Else
Session("PageViewed") = Session("PageViewed") + 1
End If
%>
ͨ¹ýÒÔÏÂÕâ¾ä»°¿ÉÒÔÈÃÓû§µÃÖª×Ô¼ºä¯ÀÀÁ˼¸¸öÒ³Ã棺
<%
Response.Write("You have viewed " & Session("PageViewed") & " pages")
%>
¿ÉÄÜÓÐЩÓÐЩ¶ÁÕß»áÎÊ£ºÕâ¸ö¿´ËÆÏñÊÇÊý×éµÄSession(“..”)ÊÇÄÄÀïÀ´µÄ£¿ÐèÒªÎÒ¶¨ÒåÂð£¿Êµ¼ÊÉÏ£¬Õâ¸öSession¶ÔÏóÊǾßÓÐASP½âÊÍÄÜÁ¦µÄµÄWWW·þÎñÆ÷µÄÄÚ½¨¶ÔÏó¡£Ò²¾ÍÊÇ˵ASPµÄϵͳÖÐÒѾ­¸øÄ㶨ÒåºÃÁËÕâ¸ö¶ÔÏó£¬ÄãÖ»ÐèҪʹÓþÍÐÐÁË¡£ÆäÖÐSession(“..”)ÖеÄ..¾ÍºÃÏñ±äÁ¿Ãû³Æ£¬Session(“..”)=$$ÖеÄ$$¾ÍÊDZäÁ¿µÄÖµÁË¡£ÄãÖ»ÐèҪдÉϾ仰£¬ÔÚÕâ¸öÓû§µÄÿ¸öÒ³ÃæÖж¼¿ÉÒÔ·ÃÎÊ..±äÁ¿ÖеÄÖµÁË¡£
ÆäʵASPÒ»¹²ÄÚ½¨ÁË7¸ö¶ÔÏó£¬ÓÐSession¡¢Application¡¢Cookie¡¢Response¡¢Request¡¢ServerµÈ¡£ÔÚÆäËûµÄ·þÎñÆ÷¶Ë½Å±¾ÓïÑÔÈçJSP¡¢PHPµÈÖÐÒ²ÓÐÆäÀàËƵĶÔÏó£¬Ö»Êǽз¨»òÕßʹÓ÷½·¨Éϲ»Ì«Ò»Ñù¡£
ASP SessionµÄ¹¦ÄܵÄȱÏÝ
Ä¿Ç°ASPµÄ¿ª·¢ÈËÔ±¶¼ÕýÔÚʹÓÃSessionÕâһǿ´óµÄ¹¦ÄÜ£¬µ«ÊÇÔÚËûÃÇʹÓõĹý³ÌÖÐÈ´·¢ÏÖÁËASP


Ïà¹ØÎĵµ£º

ASP.NET MVC ÈëÃÅ

ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......

ASP.NET ÏÂweb.config FormsÉí·ÝÑéÖ¤µÄÅäÖÃ

 ÔÚwebconfigÖÐÓÐÒ»¸öÖØÒª½Úµã <system.web> ÆäÖаüÀ¨ÁËÒ»¸öÉí·ÝÑéÖ¤ÅäÖýڵã
<authentication mode="Windows"/>
ÆäÖÐ authentication ÊǽڵãÃû£¬modeÊÇģʽ£¬ÉÏÊö´úÂë±íʾ ²ÉÓÃwindowsÉí·ÝÑéÖ¤£¬ÄÇô´ËʱÉí·ÝÑéÖ¤½«½»¸øiis´¦Àí£¬¶øiisÖÐĬÈÏÉè
  <authentication mode="Forms" >
 &n ......

Using StructureMap with the ASP.NET MVC framework

 Ô­ÎĵØÖ·:http://www.bengtbe.com/blog/post/2009/02/27/Using-StructureMap-with-the-ASPNET-MVC-framework.aspx
Using StructureMap with the ASP.NET MVC framework
2009-02-27 ÐÇÆÚÎå ×÷Õß:bengtbe
ÔÚÕâÀïÎÒÒª²ûÊöµÄÊÇÔõôÓÃ.net frameword ¿ò¼ÜϵÄStructureMapÕâ¸öÀà.  
ÔÚѧϰÕâ¸öÖ®¼äÄãÐèÒª¶ÔASP.NE ......

¶¨ÖÆASP.Net MVCµÄ´úÂëÄ£°å

ÔÚASP.Net MVCÀàÐ͵ÄÏîÄ¿ÖÐÓÒ»÷Controller Îļþ¼Ð£¬Ñ¡ÖÐAdd=>Controller¡­ºó£¬»áÔÚн¨µÄController ÖвåÈëһЩĬÈÏ´úÂë¡£   ÔÚController µÄ¸÷¸öAction·½·¨ÖÐÓÒ»÷ Add View¡­£¬Ò²»áÔÚн¨µÄViewÖвåÈëһЩ´úÂë¡£ÔÚн¨Viewʱ²åÈëµÄ´úÂë»á¸ù¾ÝÉÏÏÂÎĺÍÄãµÄÑ¡Ôñ¶ø²»Í¬£¬ËƺõÓкܴóµÄ´úÂëÉú³É¹¦ÄÜ¡£ ÉÏÊöÁ½ÕßÉú³É´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ