FormsAuthentication-Klasse

Stellt eine Authentifizierungsdienstimplementierung bereit, die die Formularauthentifizierung mithilfe von DomainContext durchführt, der von einem Domänendienst generiert wurde, der die IAuthentication-Schnittstelle implementiert.

Namespace: System.ServiceModel.DomainServices.Client.ApplicationServices
Assembly: System.ServiceModel.DomainServices.Client.Web (in system.servicemodel.domainservices.client.web.dll)

Verwendung

'Usage
Dim instance As FormsAuthentication

Syntax

'Declaration
Public Class FormsAuthentication
    Inherits WebAuthenticationService
public class FormsAuthentication : WebAuthenticationService
public ref class FormsAuthentication : public WebAuthenticationService
public class FormsAuthentication extends WebAuthenticationService
public class FormsAuthentication extends WebAuthenticationService

Hinweise

Um die Anwendung für die Formularauthentifizierung zu konfigurieren, müssen Sie Werte sowohl im Server- als auch Clientprojekt festlegen. Zum Festlegen des Werts im Clientprojekt verwenden Sie die FormsAuthentication-Klasse.

Legen Sie in der Datei Web.config des Serverprojekts den authentication mode auf “Forms” fest, wie im folgenden Beispiel gezeigt.

<system.web>
  <authentication mode="Forms"></authentication>
</system.web>

Legen Sie im Konstruktor des Application-Objekts für die Clientanwendung die Authentication-Eigenschaft des WebContext-Objekts auf FormsAuthentication fest, wie im folgenden Beispiel gezeigt. Der Konstruktor befindet sich in der Regel in einer Datei mit dem Namen App.xaml.cs oder App.xaml.vb.

Public Sub New()
    InitializeComponent()

    Dim webcontext As New WebContext
    webcontext.Authentication = New System.ServiceModel.DomainServices.Client.ApplicationServices.FormsAuthentication
    Me.ApplicationLifetimeObjects.Add(webcontext)
End Sub
public App()
{
    this.Startup += this.Application_Startup;
    this.UnhandledException += this.Application_UnhandledException;

    InitializeComponent();

    WebContext webcontext = new WebContext();
    webcontext.Authentication = new System.ServiceModel.DomainServices.Client.ApplicationServices.FormsAuthentication();
    this.ApplicationLifetimeObjects.Add(webcontext);
}

Vererbungshierarchie

System.Object
   System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationService
     System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService
      System.ServiceModel.DomainServices.Client.ApplicationServices.FormsAuthentication

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht sichergestellt.

Plattformen

Entwicklungsplattformen

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008 und Windows 2000

Zielplattformen

Change History

Siehe auch

Verweis

FormsAuthentication-Member
System.ServiceModel.DomainServices.Client.ApplicationServices-Namespace