Asp.net AJAX Web Serviceд·¨²îÒì
ÔÚC#ÖÐ
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[GenerateScriptType(typeof(Employee ))]
[ScriptService]
public class PeopleManagementService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public Employee CreateNewEmployee()
{
return new Employee();
}
}
vb.net
Imports System;
Imports System.Web;
Imports System.Web.Services;
Imports System.Web.Services.Protocols;
Imports System.Web.Script.Services;
Imports System.Collections.Generic;
Imports System.Collections;
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<GenerateScriptType(GetType(Employee))> _
<ScriptService()> _
Public Class PeopleManagementService
Inherits System.Web.Services.WebService
<WebMethod()> _
<ScriptMethod(usehttpget:=True)> _
Public Function CreateNewEmployee() As Employee
Return New Employee()
End Function
End Class
C#ÖеÄstatic,¶ÔÓ¦vb.net shared
ÒòΪ×Ô¼º»ù±¾ÉÏʹÓõÄvb.net£¬¿´µÄ×ÊÁÏÓÖ»ù±¾ÉÏÊÇC#µÄ£¬ºÜÉÙµÄvb.netµÄÀý×Ó£¬¾Í½«²îÒì¼Ç¼ÏÂÀ´
Ïà¹ØÎĵµ£º
ÒòΪ¹ýÂ˹ؼü×Ö»úÖÆµ½´¦¿É¼û£¬ÓÚÊÇ´ÏÃ÷µÄÍøÓѾͻáÏëµ½¸÷ÖÖ¸÷ÑùµÄ·½·¨Í»ÆÆ£¬ÀýÈ磺
¡¡¡¡1¡¢ÖÐÎÄ»áÓ÷±Ìå×ֵķ½·¨±Ü¿ª¹Ø¼ü×ÖɨÃè
¡¡¡¡2¡¢Ôڹؼü×ÖÖмä²åÈëÎÞÒâ˼µÄÌØÊâ×Ö·û£¬ÀýÈç * & # @ µÈ£¬¶øÇÒ¸öÊý¿É±ä
¡¡¡¡3¡¢Ê¹ÓÃгÒô»ò²ð×Ö·¨±ä»»¹Ø¼ü×Ö
¡¡¡¡ÔÚʵÏÖ×Ô¼ºµÄË㷨ʱҲÓÐЩÎÊÌ⣺
¡¡¡¡4¡¢Ëæ×Åʱ¼äÍÆÒÆ£¬¹Ø¼ü×ÖÁÐ±í» ......
ASP.NET±à³ÌÄ£ÐÍÖ®ASP.NETÒ³ÃæÉúÃüÖÜÆÚͼ½â
ASP.NET±à³ÌÄ£ÐÍÖÐASP.NETÒ³ÃæÉúÃüÖÜÆÚÊÇÖ¸Ê²Ã´ÄØ£¿Ëü°üÀ¨Ê²Ã´ÄØ£¿ASP.NET±à³ÌÄ£ÐÍÖ®ASP.NETÒ³ÃæÉúÃüÖÜÆÚ¾ßÌåµÄ¹ý³ÌÓÐÄÄÐ©ÄØ£¿ÏÂÃæ¾Í¿ªÊ¼ÎÒÃǵĽ²½â°É£º
ASP.NET Ò³ÔËÐÐʱ£¬´ËÒ³½«¾ÀúÒ»¸öÉúÃüÖÜÆÚ£¬ÔÚÉúÃüÖÜÆÚÖн«Ö´ÐÐһϵÁд¦Àí²½Öè¡£ÕâЩ²½Öè°üÀ¨³õʼ»¯¡¢ÊµÀý»¯¿Ø¼þ¡¢»¹ÔºÍ ......
MainPageÎļþ£ºWebForm1.aspx
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestMasterPage.WebForm1" enableViewState="False"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML> ......