MobileFormsAuthentication クラス
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)


このヘルパー クラスは、認証されたモバイル Web サイトの記述に役立つように設計されています。このクラス オブジェクトは、モバイル デバイスと互換性のある ASP.NET FormsAuthentication クラス メソッド (RedirectFromLoginPage および SignOut) を提供します。Web アプリケーションのセキュリティ保護の詳細については、「Security for ASP.NET Applications」を参照してください。

次のコード例は、login.aspx ページを示しています。認証は、ValidateUser 関数を使用して検証されます。Membership クラスは、データ ソースとやり取りするためにメンバシップ プロバイダを使用します。
<%@ Page Language="VB" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <%@ Import Namespace="System.Web.Security" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server"> Private Sub Login_Click(ByVal sender As Object, ByVal e As EventArgs) ' Perform Authentication check here by using ' UserEmail.Value and UserPswd.Value. If (Membership.ValidateUser(UserEmail.Text, UserPswd.Text)) Then ' Set the authorization cookie FormsAuthentication.SetAuthCookie(UserEmail.Text, False) ' Redirect from login page MobileFormsAuthentication.RedirectFromLoginPage(UserEmail.Text, True) Else ' Notify the user lblError.Text = "Login invalid. Please check your credentials" End If End Sub </script> <html > <body> <mobile:form id="form1" runat="server"> <Mobile:Label ID="Label1" runat="server">Enter username</Mobile:Label> <Mobile:TextBox id="UserEmail" runat="Server"/> <Mobile:Label ID="Label2" runat="server">Enter password</Mobile:Label> <Mobile:TextBox id="UserPswd" runat="Server"/> <Mobile:Command ID="Command1" runat="Server" OnClick="Login_Click" SoftkeyLabel="og">Go</Mobile:Command> <Mobile:Label runat="server" id="lblError" /> </mobile:form> </body> </html>
<%@ Page Language="C#" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <%@ Import Namespace="System.Web.Security" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server"> private void Login_Click(Object sender, EventArgs e) { // Perform Authentication check here by using // UserEmail.Value and UserPswd.Value. if (Membership.ValidateUser(UserEmail.Text, UserPswd.Text)) { // Set the authorization cookie FormsAuthentication.SetAuthCookie(UserEmail.Text, false); // Redirect from login page MobileFormsAuthentication.RedirectFromLoginPage(UserEmail.Text, true); } else { // Notify the user lblError.Text = "Login invalid. Please check your credentials"; } } </script> <html > <body> <mobile:form id="form1" runat="server"> <Mobile:Label runat="server">Enter username</Mobile:Label> <Mobile:TextBox id="UserEmail" runat="Server"/> <Mobile:Label runat="server">Enter password</Mobile:Label> <Mobile:TextBox id="UserPswd" runat="Server"/> <Mobile:Command ID="Command1" runat="Server" OnClick="Login_Click" SoftkeyLabel="og">Go</Mobile:Command> <Mobile:Label runat="server" id="lblError" /> </mobile:form> </body> </html>


System.Web.Mobile.MobileFormsAuthentication


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MobileFormsAuthentication メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | RedirectFromLoginPage | オーバーロードされます。 認証済みユーザーを初めに要求された URL にリダイレクトします。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | SignOut | FormsAuthentication.SignOut メソッドを呼び出し、PersistCookielessData プロパティを false に設定します。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

MobileFormsAuthentication メンバ
適切な認証情報を適切な URL に付加して、Cookie が使用できないデバイスをサポートします。
MobileFormsAuthentication データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | RedirectFromLoginPage | オーバーロードされます。 認証済みユーザーを初めに要求された URL にリダイレクトします。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | SignOut | FormsAuthentication.SignOut メソッドを呼び出し、PersistCookielessData プロパティを false に設定します。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- MobileFormsAuthenticationのページへのリンク