Export (0) Print
Expand All

AuthenticationServiceManager Class

Configures the location of a custom implementation of the authentication service.

System.Object
  System.Web.UI.AuthenticationServiceManager

Namespace:  System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public class AuthenticationServiceManager

The AuthenticationServiceManager type exposes the following members.

  NameDescription
Public methodAuthenticationServiceManagerInitializes a new instance of the AuthenticationServiceManager class.
Top

  NameDescription
Public propertyPathGets or sets the path of the authentication service.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The AuthenticationServiceManager class corresponds to the AuthenticationService property of the ScriptManager or ScriptManagerProxy control.

The authentication Web service is used by AJAX-enabled applications to log on and log off from client script. You can use AuthenticationServiceManager to provide the path of an alternative implementation of the authentication Web service instead of using the built-in Web service that is provided by the AJAX features of ASP.NET.

To use the authentication service in your application, you must enable it in the configuration file. If you use the built-in authentication Web service, you do not have to explicitly declare the authentication service manager on the page.

To create your own authentication service, you must implement a Web service that has two methods: Login and Logout. In addition, these methods require the same signature of the built-in authentication Web service.

The following example shows the basic class structure that must be implemented in a custom authentication Web service class.

<%@ WebService Language="C#" Class="MyAuthenticationService" %>

using System.Web.Services;
using System.Web.Script.Services;

[ScriptService]
public class MyAuthenticationService  : System.Web.Services.WebService 
{
    [WebMethod]
    public bool Login(string userName, 
        string password, bool createPersistentCookie)
    {
        //Place code here.
        return true;
    }

    [WebMethod]
    public void Logout()
    {
        //Place code here.
    }  
}

To use a custom authentication Web service, you can add the service declaratively in markup by including an <AuthenticationService> element inside the <asp:ScriptManager> element on the page, as shown in the following example.

<asp:ScriptManager ID="SM1" runat="server">
  <AuthenticationService Path="MyAuthenticationService.asmx" />
</asp:ScriptManager>

You can also programmatically configure Path to use a custom authentication Web service.

Regardless of whether the declarative section for the authentication service is on the page, if the authentication service is enabled in the configuration file, then AJAX-enabled applications will include an ECMAScript (JavaScript) variable in the rendered page. This allows client script to determine whether the current user is authenticated.

.NET Framework

Supported in: 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft