static±äÁ¿Óëasp.net
ÔÚC#ÖУ¬static±äÁ¿±íʾ¸Ã±äÁ¿ÊôÓÚÀ࣬¶ø²»ÊÇÀàµÄʵÀý¡£¿ÉÒÔ˵ÊǸÃÀàµÄËùÓÐʵÀý¹²ÏíÒ»¸östatic±äÁ¿¡£
asp.netµÄÒ³Ãæ¾ÍÊÇÒ»¸öÀ࣬ÎÒÃÇ·ÃÎÊÒ»¸öÒ³Ãæ¡£¾Í»áÔÚ·þÎñÆ÷ÉÏʵÀý»¯Ò»¸ö¸ÃÀàµÄʵÀý£¬À´ÏìÓ¦ÎÒÃǵÄÇëÇó¡£
“ËùÓÐʵÀý¹²ÏíÒ»¸östatic±äÁ¿” Õâ¾ÍÒâζ×Å£¬ËùÓеĿͻ§¶Ë·ÃÎʵ½µÄasp.netÒ³ÃæÖÐstatic±äÁ¿¶¼ÊÇͬһ¸ö±äÁ¿¡£
ÓÉÓÚÎÒÃÇÿ´Î·ÃÎÊasp.netÒ³Ã涼ÊÇÒ»¸öȫеĶÔÏ󣬶ø²»ÊÇÎÒÃÇÉÏÒ»´Î·ÃÎʵĶÔÏó¡£ËùÒÔÉÏ´ÎÒ³Ãæ·ÃÎÊʱÎÒÃǶÔÒ³ÃæÖбäÁ¿µÄ¸Ä¶¯¶¼Ã»Óб£Áô¡£Óöµ½Õâ¸öÎÊÌâµÄʱºò£¬ºÜ¶à³õѧÕßµÄÖ±¾õ¾ÍÊǽ«Õâ¸ö±äÁ¿ÉêÃ÷Ϊstatic£¬×Ô¼ºÔÚ²âÊÔµÄʱºò·¢ÏÖ»¹ÕæµÄ±£ÁôסÁËÒ³ÃæµÄ״̬¡£ÇÔϲ֮ÓàûÓз¢ÏÖÕâÓÖÓÐÒýÈëÁËÁíÍâÒ»¸ö´íÎó¡£ÒòΪÄãÒªµÄÖ»ÊÇÒ³ÃæÄܱ£Áôס״̬£¬¶øÕâ¸ö״̬ÊÇÕë¶ÔÒ»¸ö¿Í»§¶ËµÄ£¨sessionµÄЧ¹û£©¡£¶øµÃµ½µÄ½á¹ûÊÇÖ»ÒªÒ»¸ö¿Í»§¶Ë¸Ä±äÁ˸ÃÖµËùÓеÄÆäËû¿Í»§¶Ë¶¼Êܵ½ÁËÓ°Ï죨ÈçͬApplicatinµÄЧ¹û£©¡£ÕâÖÖÇé¿öÏ£¬ÐèÒªµÄ¼«ÓпÉÄܾÍÊǸöViewState»òÕßÊÇSession¡£
ÔÌûµØÖ· http://www.cnblogs.com/meyer/archive/2004/04/27/7846.aspx
Ïà¹ØÎĵµ£º
<HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>
<META http-equiv=Content-Type c>
<SCRIPT language=JScript event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
var MACaddress=unescape(MACAddr);
alert(MACaddress);
document.forms[0].txtMACAddr.value=u ......
ASP.net »ñµÃ¿Í»§¶ËµÄIP£¬×î³£¼ûµÄÊÇʹÓÃÏÂÊö´úÂ룺 string user_IP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
¶ÔÓÚÁ˽â´úÀí·þÎñÆ÷Çé¿öµÄÈË£¬ÎÒÃÇ»áÖªµÀ£¬Èç¹ûÓû§Ê¹ÓÃÁË´úÀí·þÎñÆ÷£¬ÉÏÊö´úÂë»ñµÃµÄÊÇ´úÀí·þÎñÆ÷µÄIPµØÖ·£»Èç¹ûÓû§Ê¹ÓÃÁ˶à¸ö´úÀí·þÎñÆ÷£¬ÔòÊǵ½´ï·þÎñÆ÷µÄ×îºóÒ ......
Ö±½Ó°ÑÊý¾Ý¿â·ÅÖÃApp_dataÎļþ¼ÐÖУ¬Ìí¼ÓÒ»¸öweb.configÅäÖÃÎļþÈ»ºóдÈçÏ´úÂë
<connectionStrings>
<add name="users" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Users.mdf;Integrated Security=True;User Instance=True" providerName="System.Data ......
ÔÀ´µÄMembership
ÎÒÃÇÖªµÀÔÚAsp.Net 2.0ÖÐ΢Èí¾ÍΪÎÒÃÇÌṩÁËÇ¿´óµÄȨÏÞ¹ÜÀí¹¦ÄÜÀ´°ïÖúÎÒÃǹÜÀíAsp.NetÏàÓ¦µÄȨÏÞ£¬ÆäʵËüÊǶÔÎÒÃǵÄÉí·ÝÈÏÖ¤ºÍȨÏÞ¹ÜÀíµÄÒ»ÖÖ³éÏó¡£ÕâÀï¼òµ¥µÄÁ˽âÒ»ÏÂMembership£º
ÎÒÃÇÓ¦¸ÃÖªµÀ΢Èí¹ØÓÚÈÏÖ¤·½Ãæ¸øÎÒÃÇÌṩÁËÈýÖÖÈÏÖ¤·½Ê½windows ¡¢Forms¡¢Passport,ÎÒÏëÊìϤAsp.Net ......
<%%>ÊÇÔÚ³ÊÏÖÒ³ÃæµÄ¹ý³ÌÖÐÖ´ÐеķþÎñÆ÷´úÂ룬°üÀ¨·½·¨£¬±äÁ¿£¬Ò»°ãÊÇǶÈëʽ·þÎñÆ÷´úÂëд·¨£¬²»ÊʺϷÖÀëģʽ¡£
<%=%>ÊÇÔÚ³ÊÏÖÒ³ÃæµÄ¹ý³ÌÖÐÖ´ÐеķþÎñÆ÷´úÂ룬Ö÷ÒªÊDZäÁ¿µÄÖµ¡£
<%#%>¿É°üÀ¨±äÁ¿£¬±í´ïʽ£¬»òÕßµ÷Ó÷½·¨·µ»ØµÄÖµ£¬µ«±ØÐëµÄ±£Ö¤Õâ¶Î´úÂëλÓÚ
°ó¶¨¿Ø¼þµÄÄÚ²¿£¬ÒòΪֻÓе±°ó¶¨¿Ø¼þÔÚÖ´ÐÐD ......