Udostępnij za pośrednictwem


ASP.NET Application Services Overview

Note

This topic pertains to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation.

ASP.NET application services are built-in Web services that provide access to features such as forms authentication, roles, and profile properties. These services are part of a service-oriented architecture (SOA), in which an application consists of one or more services provided on the server, and one or more clients. For more information about SOA, see Understanding Service-Oriented Architecture on the MSDN Web site.

An important feature of ASP.NET application services is that they are available to a variety of client applications, not just ASP.NET Web applications. ASP.NET application services are available to any client that is based on the .NET Framework. In addition, any client application that can send and receive messages in SOAP format can use ASP.NET application services.

This topic contains the following information.

  • Scenarios

  • Background

  • Examples

  • Class Reference

  • Additional Resources

Scenarios

Client applications for ASP.NET application services can be of different types and can run on different operating systems. These include these following types of clients:

  • AJAX clients. These are ASP.NET Web pages (.aspx files) that run in the browser and that access application services from client script. AJAX clients typically use JSON format to exchange data. For more information, see Using Web Services in ASP.NET AJAX.

  • .NET Framework clients. These are .NET Framework Windows applications that access application services over HTTP by using the provider model infrastructure, and that use JSON protocol to exchange data. For more information, see Client Application Services Overview.

    Note

    The provider model adapts the membership system to use different data stores, or data stores with different schemas. For more information, see Membership Providers.

  • SOAP clients. These are clients that can access application services through SOAP 1.1. This is useful for clients that are running on other operating systems or using other technologies, such as Java applications. For more information, see Walkthrough: Using ASP.NET Application Services.

The following illustration shows how different clients communicate with the services.

Web Services communication

Web Services Communication Protocols

Background

The application services provided by ASP.NET enable client applications to access and share information that is part of a Web application. ASP.NET makes available the following application services:

  • Authentication service. This service enables you to let users log onto an application. The service accepts user credentials and returns an authentication ticket (cookie). For more information, see ASP.NET Forms Authentication Overview.

  • Roles service. This service determines the application-related roles for an authenticated user, based on information that is made available by an ASP.NET roles provider. This can be useful if you want to provide specific UI or enable access to specific resources, depending on the user's role. For more information, see Managing Authorization Using Roles.

  • Profile service. This service provides per-user information as a user profile that is stored on the server. This enables your application to access a user's settings at different times and from different client UI components. For more information, see ASP.NET Profile Properties Overview.

Application Service Clients

This section provides details about the types of client applications that can use ASP.NET application services and some information about how the client communicates with an application service.

AJAX Clients

AJAX clients (AJAX-enabled ASP.NET Web pages) exchange data with application services over HTTP by using POST requests. The data is packaged in JSON format. The client application communicates with the application services through client-script proxy classes. The proxy classes are generated by the server and downloaded to the browser as part of any page that calls an application service. For more information, see Using Web Services in ASP.NET AJAX.

.NET Framework Clients

ASP.NET application services exchange data with .NET Framework clients over HTTP by using POST requests. The data is packaged in JSON format. The client application communicates with the application services by using the .NET Framework provider model. For ASP.NET application services, the provider model refers to the .NET Framework client types and the related membership providers that store and retrieve user's credentials from a data source. For example, this includes the SqlMembershipProvider class.  

The communication between client and server is synchronous. For more information, see Client Application Services Overview. The application services are implemented by the types that are defined in the System.Web.ClientServices.Providers namespace.

To access an application service, a .NET Framework client application must be configured appropriately. The server configuration is the same as the one used for the application services in AJAX.

For more information about the provider model, see ASP.NET 2.0 Provider Model: Introduction to the Provider Model and Introduction to Membership.

SOAP Clients

You can access ASP.NET authentication, profile, and roles services from any client application on any operating system that can use SOAP 1.1 protocol. ASP.NET application services are built on the Windows Communication Foundation (WCF) and exchange data with the client in SOAP format. For more information, see XML Web Services Infrastructure on the MSDN Web site.

Communication between the client and the application services is performed by using proxy classes that run in the client and that represent the application service. You can generate proxy classes that support ASP.NET application services by using the Service Model Metadata Utility Tool (svcutil.exe) tool. For more information, see Walkthrough: Using ASP.NET Application Services.

The following proxy classes are supported:

  • Authentication service client. The generated authentication-service client proxy class enables you to use the authentication service from any client application that can send and read SOAP messages. Users of an ASP.NET application and of an application that does not use the .NET Framework can authenticate by using the same user credentials. Authentication tickets that are issued by the service are created as HTTP cookies and are compatible with ASP.NET forms authentication. For more information, see How to: Enable the WCF Authentication Service. For more information about authentication tickets, see FormsAuthenticationTicket.

    Note

    The authentication service does not support embedding the authentication ticket in the URL. Therefore, cookies must be supported and enabled on the client to retain the authentication ticket.

  • Role service client. The generated role service client proxy enables you to use the role service from any client application that can send and read SOAP messages. For more information, see How to: Enable the WCF Role Service.

  • Profile service client. The generated profile service client proxy enables you to use the profile service from any client application that can send and read SOAP messages. Users of an ASP.NET application and of an application that does not use the .NET Framework can access the same user settings. For more information, see How to: Enable the WCF Profile Service.

Back to top

Examples

For examples of how to call application services from AJAX clients, see the following topics:

For examples of how to call application services from .NET Framework clients, see the following topics:

For examples of how to call application services from SOAP clients, see the following topics:

Back to top

Class Reference

The following tables list the main types that are associated with calling ASP.NET application services from client applications.

Client Namespaces

The following table lists namespaces that contain classes and types that are used with client script to call ASP.NET application services.

Name

Description

Sys.Services Namespace

Contains types that provide script access in ASP.NET AJAX applications to the ASP.NET authentication service, profile service, and roles application services. The Sys.Services namespace is part of the Microsoft AJAX Library.

Server Namespaces

The following table lists namespaces that contain classes and types that support ASP.NET application services for server programming.

Name

Description

System.Web.ApplicationServices

Provides classes that enable you to access Web application services.

System.Web.ClientServices

Provides classes that support access in Windows-based applications to the ASP.NET login, roles, and profiles services.

System.Web.ClientServices.Providers

Contains client service providers and other classes that support access in Windows-based applications to the Web application services.

Back to top

Additional Resources

What is Windows Communication Foundation?

Understanding Service-Oriented Architecture

XML Web Services Infrastructure

Back to top

See Also

Tasks

How to: Enable the WCF Authentication Service

How to: Enable the WCF Role Service

How to: Enable the WCF Profile Service

Concepts

Using Web Services in ASP.NET AJAX