SettingsAllowAnonymousAttribute コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


ユーザーが匿名ユーザーである場合、そのユーザーがカスタム プロファイル実装のプロパティにアクセスできるかどうかを識別するには、SettingsAllowAnonymousAttribute クラスが使用されます。匿名ユーザーの識別を有効にする方法については、anonymousIdentification 構成要素を参照してください。
プロファイル プロパティに対して SettingsAllowAnonymousAttribute が指定されていない場合、そのプロファイル プロパティへの匿名アクセスは許可されません。
カスタム プロファイルの実装は ProfileBase 抽象クラスから継承したクラスであり、profile 構成要素で指定されていないユーザー プロファイルのプロパティを定義します。

ProfileBase クラスから継承するクラスを定義して、カスタム プロファイルを作成する例を次に示します。カスタム プロファイルの型は、アプリケーションの Web.config ファイルにある profile 構成要素の inherits 属性を使用して指定します。カスタム プロファイル実装を指定する構成ファイルの例は、SettingsAllowAnonymousAttribute クラスの概要を参照してください。
Imports System Imports System.Web.Profile Namespace Samples.AspNet.Profile Public Class EmployeeProfile Inherits ProfileBase <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Department As String Get Return MyBase.Item("EmployeeDepartment").ToString() End Get Set MyBase.Item("EmployeeDepartment") = value End Set End Property <SettingsAllowAnonymous(False)> _ <ProfileProvider("EmployeeInfoProvider")> _ Public Property Details As EmployeeInfo Get Return CType(MyBase.Item("EmployeeInfo"), EmployeeInfo) End Get Set MyBase.Item("EmployeeInfo") = value End Set End Property End Class Public Class EmployeeInfo Public Name As String Public Address As String Public Phone As String Public EmergencyContactName As String Public EmergencyContactAddress As String Public EmergencyContactPhone As String End Class End Namespace
using System; using System.Web.Profile; namespace Samples.AspNet.Profile { public class EmployeeProfile : ProfileBase { [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public string Department { get { return base["EmployeeDepartment"].ToString(); } set { base["EmployeeDepartment"] = value; } } [SettingsAllowAnonymous(false)] [ProfileProvider("EmployeeInfoProvider")] public EmployeeInfo Details { get { return (EmployeeInfo)base["EmployeeInfo"]; } set { base["EmployeeInfo"] = value; } } } public class EmployeeInfo { public string Name; public string Address; public string Phone; public string EmergencyContactName; public string EmergencyContactAddress; public string EmergencyContactPhone; } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SettingsAllowAnonymousAttribute コンストラクタのページへのリンク