ASP.NET
ÔÚÐí¶àÓ¦ÓóÌÐòÖУ¬ÐèÒª´æ´¢²¢Ê¹ÓöÔÓû§Î¨Ò»µÄÐÅÏ¢¡£Óû§·ÃÎÊÕ¾µãʱ£¬Äú¿ÉÒÔʹÓÃÒÑ´æ´¢µÄÐÅÏ¢ÏòÓû§ÏÔʾ Web Ó¦ÓóÌÐòµÄ¸öÐÔ»¯°æ±¾¡£¸öÐÔ»¯Ó¦ÓóÌÐòÐèÒª´óÁ¿µÄÔªËØ£º±ØÐëʹÓÃΨһµÄÓû§±êʶ·û´æ´¢ÐÅÏ¢£¬Äܹ»ÔÚÓû§ÔٴηÃÎÊʱʶ±ðÓû§£¬È»ºó¸ù¾ÝÐèÒª»ñÈ¡Óû§ÐÅÏ¢¡£ÈôÒª¼ò»¯Ó¦ÓóÌÐò£¬¿ÉÒÔʹÓà ASP.NET ÅäÖÃÎļþ¹¦ÄÜ£¬¸Ã¹¦ÄÜ¿ÉΪÄúÖ´ÐÐËùÓÐÉÏÊöÈÎÎñ¡£
ASP.NET ÅäÖÃÎļþ¹¦Äܽ«ÐÅÏ¢Óëµ¥¸öÓû§¹ØÁª£¬²¢²ÉÓó־ÃÐԵĸñʽ´æ´¢ÕâЩÐÅÏ¢¡£Í¨¹ýÅäÖÃÎļþ£¬¿ÉÒÔ¹ÜÀíÓû§ÐÅÏ¢£¬¶øÎÞÐè´´½¨ºÍά»¤×Ô¼ºµÄÊý¾Ý¿â¡£´ËÍ⣬ͨ¹ýʹÓÿɴÓÓ¦ÓóÌÐòÖеÄÈκÎλÖ÷ÃÎʵÄÇ¿ÀàÐÍ API£¬¾Í¿ÉÒÔ½èÖú ASP.NET ÅäÖÃÎļþ¹¦ÄÜʹÓÃÏà¹ØµÄÓû§ÐÅÏ¢¡£
¿ÉÒÔʹÓÃÅäÖÃÎļþ´æ´¢ÈκÎÀàÐ͵ĶÔÏó¡£ÅäÖÃÎļþ¹¦ÄÜÌṩÁËÒ»ÏîͨÓô洢¹¦ÄÜ£¬Ê¹ÄúÄܹ»¶¨ÒåºÍά»¤¼¸ºõÈκÎÀàÐ͵ÄÊý¾Ý£¬Í¬Ê±ÈÔ¿ÉÓÃÀàÐÍ°²È«µÄ·½Ê½Ê¹ÓÃÊý¾Ý¡£
1¡¢ASP.NET ÅäÖÃÎļþµÄ¹¤×÷·½Ê½
ÈôҪʹÓÃÅäÖÃÎļþ£¬Ê×ÏÈӦͨ¹ýÐÞ¸Ä ASP.NET Web Ó¦ÓóÌÐòµÄÅäÖÃÎļþÀ´ÆôÓÃÅäÖÃÎļþ¡£ÒªÔÚÅäÖÃÖÐÖ¸¶¨ÅäÖÃÎļþÌṩ³ÌÐò£¬¸ÃÌṩ³ÌÐòÊÇÖ´Ðд洢ºÍ¼ìË÷ÅäÖÃÎļþÊý¾ÝµÈµÍ¼¶ÈÎÎñµÄ»ù´¡Àà¡£¿ÉÒÔʹÓà .NET Framework ÖаüÀ¨µÄÅäÖÃÎļþÌṩ³ÌÐò£¨»á½«ÅäÖÃÎļþÊý¾Ý´æ´¢ÔÚ SQL Server ÖУ©£¬Ò²¿ÉÒÔ°´ÕÕ ÊµÏÖÅäÖÃÎļþÌṩ³ÌÐò Ö÷ÌâÖÐÃèÊöµÄÄÇÑù´´½¨²¢Ê¹ÓÃ×Ô¼ºµÄÅäÖÃÎļþÌṩ³ÌÐò¡£¿ÉÒÔÖ¸¶¨Á¬½Óµ½ËùÑ¡µÄÊý¾Ý¿âµÄ SqlProfileProvider ʵÀý£¬Ò²¿ÉÒÔʹÓý«ÅäÖÃÎļþÊý¾Ý´æ´¢ÔÚ±¾µØ Web ·þÎñÆ÷ÉϵÄĬÈÏ SqlProfileProvider ʵÀý¡£
ͨ¹ý¶¨ÒåҪά»¤ÆäÖµµÄÊôÐÔµÄÁÐ±í£¬¿ÉÒÔ¶ÔÅäÖÃÎļþ¹¦ÄܽøÐÐÅäÖá£ÀýÈ磬Äú¿ÉÄÜÐèÒª´æ´¢Óû§µÄÓÊÕþ±àÂ룬ÒÔʹÄúµÄÓ¦ÓóÌÐò¿ÉÒÔÌṩÌض¨ÓÚÇøÓòµÄÐÅÏ¢£¬ÈçÌìÆøÔ¤±¨µÈ¡£ÔÚÅäÖÃÎļþÖУ¬Ó¦¶¨ÒåÒ»¸öÃûΪ PostalCode µÄÅäÖÃÎļþÊôÐÔ¡£ÅäÖÃÎļþµÄ profile ½ÚÓëÈçÏÂËùʾÀàËÆ£º
<profile>
<properties>
<add name="PostalCode" />
</properties>
</profile>
Ó¦ÓóÌÐòÔËÐÐʱ£¬ASP.NET »á´´½¨Ò»¸ö ProfileCommon À࣬¸ÃÀàÊÇÒ»¸ö¶¯Ì¬Éú³ÉµÄÀ࣬´Ó ProfileBase Àà¼Ì³Ð¶øÀ´¡£¶¯Ì¬µÄ ProfileCommon Àà°üÀ¨¸ù¾ÝÔÚÓ¦ÓóÌÐòÅäÖÃÖÐÖ¸¶¨µÄÅäÖÃÎļþÊôÐÔ¶¨Òå´´½¨µÄÊôÐÔ¡£È»ºó£¬»á½«´Ë¶¯Ì¬ ProfileCommon ÀàµÄʵÀýÉèÖÃΪµ±Ç° HttpContext µÄ Profile ÊôÐÔµÄÖµ£¬²¢ÇÒ¿ÉÔÚÓ¦ÓóÌÐòµÄÒ³ÖÐʹÓá£
ÔÚÓ¦ÓóÌÐòÖÐ
Ïà¹ØÎĵµ£º
ÕâÊÇÎÒ´Ó±ð´¦Õª³µÄһƪÎÄÕ£¬ÏàÐÅ´ó¼Ò¶¼ºÜÊìϤµÄ£¬½²µÄºÜÃ÷°×£¬µ«ÊÇÎÒ¶ÔÆäÖÐÒ»µã´æÓÐÒÉ»ó£¬Ðí¾ÃҲûÓÐÕÒµ½´ð°¸¡£
µ÷ÓÃwebserviceʱ¿ÉÒÔ·µ»ØdatatableµÈ¸´ÔÓÊý¾ÝÀàÐÍ£¬ÏÂÃæÀý×ÓÖÐÒ²Óеģ¬ÔÚǰ̨µ÷ÓÃʱ£¬ÆäʵÕâЩÊý¾ÝÀàÐ;¹ýÁËת»»Æ÷´¦Àí¡£ÏÂÃæµÄÀý×ÓÖУ¬·µ»ØµÄdatatable±»Ò»ÏîÒ»ÏîÌí¼Óµ½selectÉÏÈ¥ÁË£¬ÆäʵÎÒ¿´ÁË¾Í ......
ÔÚweb¿ª·¢Öо³£»áÅöµ½cssÑùʽµÄÔËÓã¬ÎÒ¾ÍÔÚasp.netÖÐÔËÓÃÑùʽ½øÐÐÁË×ܽᣡ
1¡¢Ê¹ÓÃstyleÊôÐÔÉèÖÃÑùʽ
•
nʵÀý
•StyleÊôÐÔÉèÖÃ
<asp:TextBox ID="TextBox1" runat="server"
style="background-color:Red; font-size:15px">
</asp:TextBox>
2¡¢Ê¹ÓÃCssclassÊôÐÔÉèÖà ......
µÚÒ»²½£º
½«Ä³¸öÒ³ÃæµÄ·½·¨ ÓÐ webmethod attribute;
[WebMethod]
//Ö»ÄÜÊÇ public static µÄ·½·¨
public static DateTime GetCurrentTime()
{
return DateTime.UtcNow;
}
µÚ¶þ²½£º
Ò³ÃæÓÐÒ»¸öScriptManager ÉèÖÃËüµÄenablepagemethod=true;
asp:ScriptManager ID="Scri ......
»ñÈ¡Óйط¢³öÒ³ÇëÇóµÄÓû§µÄÐÅÏ¢¡£
Ò»¡¢HttpContext Àà
·â×°Óйظö±ð HTTP ÇëÇóµÄËùÓÐ HTTP Ìض¨µÄÐÅÏ¢¡£
HttpContext ÀàÐ͹«¿ªÒÔϳÉÔ±¡£
¹¹Ô캯Êý
Ãû³Æ
˵Ã÷
HttpContext
ÒÑÖØÔØ¡£ ³õʼ»¯ LinePragmaCodeInfo ÀàµÄÒ»¸öÐÂʵÀý¡£
·½·¨
Ãû³Æ
˵Ã÷
AddError
½«Òì³£Ìí¼Óµ½µ±Ç° HTTP ÇëÇóµÄÒ ......
״̬¹ÜÀíÊÇÄú¶Ôͬһҳ»ò²»Í¬Ò³µÄ¶à¸öÇëÇóά»¤×´Ì¬ºÍÒ³ÐÅÏ¢µÄ¹ý³Ì¡£ÓëËùÓлùÓÚ HTTP µÄ¼¼ÊõÒ»Ñù£¬Web ´°ÌåÒ³ÊÇÎÞ״̬µÄ£¬ÕâÒâζ×ÅËüÃDz»×Ô¶¯Ö¸Ê¾ÐòÁÐÖеÄÇëÇóÊÇ·ñÈ«²¿À´×ÔÏàͬµÄ¿Í»§¶Ë£¬»òÕßµ¥¸öä¯ÀÀÆ÷ʵÀýÊÇ·ñÒ»Ö±Ôڲ鿴ҳ»òÕ¾µã¡£´ËÍ⣬µ½·þÎñÆ÷µÄÿһÍù·µ¹ý³Ì¶¼½«Ïú»Ù²¢ÖØд´½¨Ò³£»Òò´ ......