Ajax|asp.net|web
found that the latest version of the changes are very large, below the test situation for a description (here to borrow the official example):
1, first build a WebService file (helloworldservice.asmx), the code is as follows:
<%@ WebService language= "C #" class= "Samples.AspNet.HelloWorldService"%>
Using System;
Using System.Web;
Using System.Web.Services;
Using System.Xml;
Using System.Web.Services.Protocols;
Using Microsoft.Web.Script.Services;
Namespace Samples.aspnet
{
[WebService (Namespace = "http://tempuri.org/")]
[WebServiceBinding (ConformsTo = wsiprofiles.basicprofile1_1)]
[ScriptService]
public class HelloWorldService:System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld (string query)
{
String inputstring = Server.HTMLEncode (query);
if (! String.IsNullOrEmpty (inputstring))
{
Return String.Format ("Hello, your queried for {0}.") The "
+ "Current time is {1}", InputString, DateTime.Now);
}
Else
{
Return "The query string is null or empty";
}
}
}
}
Here to explain the [ScriptService] attribute, only the addition of this property, in order to be in the page through JS asynchronous call;
2, build a call page (ajaxscript1.aspx), as follows:
<%@ Page language= "C #"%>
Search for
/>
Note that here's
Put it in the
.
Change seems to be very big!
Http://www.cnblogs.com/seekinghu/archive/2006/11/07/552998.html