次の方法で共有


FormsAuthentication クラス

IAuthentication インターフェイスを実装するドメイン サービスから生成された DomainContext を使用してフォーム認証を実行する認証サービスの実装を提供します。

名前空間: System.ServiceModel.DomainServices.Client.ApplicationServices
アセンブリ: System.ServiceModel.DomainServices.Client.Web (system.servicemodel.domainservices.client.web.dll 内)

使用方法

'使用
Dim instance As FormsAuthentication

構文

'宣言
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

解説

フォーム認証を使用するアプリケーションを構成するには、サーバーとクライアント プロジロェクトの両方に値を設定する必要があります。クライアント プロジェクトに値を設定する場合は、FormsAuthentication クラスを使用します。

サーバー プロジェクトの Web.config ファイルで、認証モード"Forms"に設定します。次に例を示します。

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

クライアント アプリケーションの アプリケーション オブジェクトのコンストラクターで、WebContext オブジェクトの認証プロパティを FormsAuthentication に設定します。次に例を示します。通常、コンストラクターは、App.xaml.cs または 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);
}

継承階層

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

スレッド セーフ

この型の public static (Visual Basic では Shared) メンバーは、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 、Windows Server 2008、および Windows 2000

ターゲット プラットフォーム

Change History

参照

リファレンス

FormsAuthentication のメンバー
System.ServiceModel.DomainServices.Client.ApplicationServices 名前空間