Asp.netµ÷ÓÃwebservice
ÕâÊÇÎÒ´Ó±ð´¦Õª³µÄһƪÎÄÕ£¬ÏàÐÅ´ó¼Ò¶¼ºÜÊìϤµÄ£¬½²µÄºÜÃ÷°×£¬µ«ÊÇÎÒ¶ÔÆäÖÐÒ»µã´æÓÐÒÉ»ó£¬Ðí¾ÃҲûÓÐÕÒµ½´ð°¸¡£
µ÷ÓÃwebserviceʱ¿ÉÒÔ·µ»ØdatatableµÈ¸´ÔÓÊý¾ÝÀàÐÍ£¬ÏÂÃæÀý×ÓÖÐÒ²Óеģ¬ÔÚǰ̨µ÷ÓÃʱ£¬ÆäʵÕâЩÊý¾ÝÀàÐ;¹ýÁËת»»Æ÷´¦Àí¡£ÏÂÃæµÄÀý×ÓÖУ¬·µ»ØµÄdatatable±»Ò»ÏîÒ»ÏîÌí¼Óµ½selectÉÏÈ¥ÁË£¬ÆäʵÎÒ¿´Á˾ÍÊÇÒ»¸öArray£¬ÔÚǰ̨²»ÄÜÊý¾Ý°ó¶¨µÄ£¬ÕâÑùdatatableµÄÒâÒå¾Í²»ÊǺܴóÁË¡£Èç¹û¶ÔÓÚgridviewµÈǰ̨±íÏÖΪtableµÄ¿Ø¼þÓÖ¸ÃÈçºÎ´¦ÀíÄØ£¬×ܲ»ÄÜ»¹ÊÇÕâÑùÌí¼ÓÏî°É£¡
ASP.NET 2.0 AJAXÖÐÄܹ»ÔÚ¿Í»§¶ËjsÖкܷ½±ãµØµ÷Ó÷þÎñÆ÷Webservice£¬ÒÔÏÂΪһЩµ÷ÓõÄʾÀý¡£±ÊÕß°²×°µÄASP.NET 2.0 AJAX
°æ±¾ÎªAJAX November CTP¡£
Èý¸öʾÀý·Ö±ðΪ£º
1 ´ø²ÎÊýµÄWS·½·¨
2 ²»´ø²ÎÊýµÄWS·½·¨
3 ²ÎÊýÀàÐÍΪDataTableµÄWS·½·¨
Ò»¡¢WebMethod
×¢ÒâÒªµã£º
1 WebMethodÀàÐèÒªÌí¼ÓÃüÃû¿Õ¼ä Microsoft.Web.Script.Services£¬´Ë¿Õ¼äÐèÒªÒýÓÃMicrosoft.Web.Preview.dll
2 ÀàÉùÃ÷¼ÓÈë±êÇ© [ScriptService]
3 ÔÚAsp.net 2.0Àï¿ÉÒÔÖ±½ÓÓÃDataTable×÷Ϊ·µ»ØÀàÐÍÁË£¬µ«ÊÇÐèÒªÔÚWeb.configÎļþÌí¼ÓÐòÁл¯×ª»»Æ÷µÄÊôÐÔ¡£DataSet¡¢DataTable¡¢DataRow¾ùÓÐת»»Æ÷
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization>
<converters>
<add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/>
<add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/>
<add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview"/>
</converters>
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
WEB·þÎñ1£ºWS1
using System;
using System.Web;
using System.Coll
Ïà¹ØÎĵµ£º
<HTML><HEAD>
<TITLE>ÍøÒ³ÌØЧ¹ÛÖ¹|JsCode.CN|---Ò³ÃæÓÒϽǵ¯³öÀàËÆQQ»òMSNµÄÏûÏ¢Ìáʾ</TITLE>
<SCRIPT language=JavaScript>
<!--
/**//*
** ==================================================================================================
**&nbs ......
1.¹Ø±Õ²»±ØÒªµÄSession
<%@ Page EnableSessionState="flase"%>
2.¹Ø±Õ²»±ØÒªµÄViewState
<asp:DataGrid EnableViewState="false" runat="server">
Èç¹ûÒ³Ã漶
<%@ Page EnableViewState="false"%>
3.²»ÒªÊ¹ÓÃException¿ØÖƳÌÐòÁ÷³Ì
ExceptionÊǺܺÄ×ÊÔ´µÄ
4.½ûÓÃVBºÍJScript¶¯Ì¬Êý ......
×÷Õߣº°½Ê¿Î°
Ò»¡¢ÏîÄ¿ÖÐÒýÓÃlog4net.dll
¶þ¡¢AssemblyInfo.csÖмÓÈ룺
[assembly:log4net.Config.DOMConfigurator(ConfigFile="log4net.xml", Watch=true)]
˵Ã÷£ºÖ¸Ã÷log4net.xmlÅäÖÃÎļþ
Èý¡¢´úÂëÖÐʹÓÃLog4net
using log4net;
ILog log = LogManager.GetLogger("log4net");
log.Info("It's OK!");
¸½£ ......
Óû§¿Ø¼þÊÇASP.NETÖкÜÖØÒªµÄÒ»²¿·Ö£¬Ê¹ÓÃËü¿ÉÒÔÌá¸ß³ÌÐò´úÂëµÄÖØÓÃÐÔ£¬¼´Ò»¸öÓû§¿Ø¼þÔÚÍøÒ³¡¢Óû§¿Ø¼þ»ò¿Ø¼þµÄÄÚ²¿¶¼¿ÉÒÔÔÙ´ÎʹÓᣱ¾ÊµÀý½éÉÜÓû§µÇ¼µÄÓû§¿Ø¼þÒ²¿ÉÒÔÔÚÍøÕ¾µÄÈκεط½ÔÙ´ÎʹÓá£
¼¼ÊõÒªµã
±¾ÊµÀý½éÉÜÈçºÎÔÚASP.NETÖд´½¨Óû§¿Ø¼þ¡¢ÈçºÎʹÓÃÓû§¿Ø¼þ£¬ÒÔ¼°ÈçºÎÔÚÓû§¿Ø¼þÖж¨Ò幫¿ªÊôÐÔµÄʵÏÖ·½·¨¡£
......
ÔÚÕÆÎÕ·þÎñÆ÷¿Ø¼þÉúÃüÖÜÆڵĹý³ÌÖУ¬¶ÁÕßÒªÌرð×¢ÒâÓйطþÎñÆ÷¿Ø¼þ״̬µÄÏà¹ØÄÚÈÝ¡£ÔÚÖصãÁ˽âÉúÃüÖÜÆÚ¸÷¸ö½×¶ÎµÄͬʱ£¬¶Ô·þÎñÆ÷¿Ø¼þµÄ״̬±ä»¯Òª×¢ÒâÒÔÏÂÎÊÌ⣺¿Ø¼þµÄÉúÃüÖÜÆÚºÎʱ±£´æ¿Ø¼þºÍ»Ö¸´Æä״̬£»ºÎʱÓëÒ³Ãæ¼°ÆäËû¿Ø¼þÖ®¼ä½øÐн»»¥£»ºÎʱִÐÐÖØÒªµÄ´¦ÀíÂß¼£»ÔÚ¸÷¸ö½×¶Î£¬¿Ø¼þ¿ÉʹÓÃÄÄЩÐÅÏ¢¡¢±£³ÖÄÄЩÊý¾Ý¡¢ ......