asp.net AJAX Beta2 invoke some changes to the local webservice

Source: Internet
Author: User
Tags current time net query return string
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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.