JavaScript calls in ASP. NET AJAX

Source: Internet
Author: User

Development Platform
1. VisualStudio2008SP1
2. NETFramework3.5SP1
3. ASP. NET AJAX
4. IIS7 or VS integrated Web server [WCF and SVS file configuration]
5. Windows Vista

WCF (WindowsCommunicationFoundation) adds many features to enhance the Microsoft Application Development Platform, especially for communications between applications. In this article, we will learn how WCF is used directly in client JavaScript. This is a cool feature provided by ASP. net ajax. In this article, we will not discuss much about the internal details of WCF, but will focus on how to directly use services in JavaScript. Therefore, we will not discuss how to manage the features of these functions during ASP. NET or. NET runtime.

To demonstrate the theories and facts involved in this article, we will create a solution with two projects. Therefore, you do not need to waste time creating a blank solution and saving it. Now, add a new class library project to the solution. Name the class library ServiceLibrary. Then, add a Web application project to the solution and name it WEBUI. We will see two ways to add a WCF Service that can be called by JavaScript.

1. Use the AJAX-enabled WCF Service item Template
2. Use the service interface definition in the class library

Use the AJAX-enabled WCF Service item Template

Here, we will see a simple and clear way to call a WCF Service in JavaScript. Right-click the Web application project and choose add new project. Select the AJAX-enabled WCF Service item template, name it "HelloWorldService. svc", and click "OK. In this case, the wizard will add a HelloWorldService. svc file as expected to the solution. This file also provides the code separation page. If you open the file in an XML file editor, you will see the following labels:

 
 
  1. <%@ ServiceHost Language="C#" Debug="true" 
  2. Service="WebUI.HelloWorldService" CodeBehind="HelloWorldService.svc.cs" %> 

The above is a JavaScript call in ASP. net ajax.

  1. SQL statements in ASP. NET
  2. Use StringBuilder in ASP. NET
  3. Response. Write in ASP. NET
  4. Analysis on ASP. NET authorization Module
  5. Processing Process for ASP. NET Runtime

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.