SettingsAllowAnonymousAttribute クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SettingsAllowAnonymousAttribute クラスの意味・解説 

SettingsAllowAnonymousAttribute クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

プロファイルプロパティ設定できるかどうか、またはプロファイル プロパティ匿名ユーザーアクセスできるかどうか識別します。

名前空間: System.Web.Profile
アセンブリ: System.Web (system.web.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Property)> _
Public NotInheritable Class
 SettingsAllowAnonymousAttribute
    Inherits Attribute
Dim instance As SettingsAllowAnonymousAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] 
public sealed class SettingsAllowAnonymousAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] 
public ref class SettingsAllowAnonymousAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property) */ 
public final class SettingsAllowAnonymousAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Property) 
public final class SettingsAllowAnonymousAttribute
 extends Attribute
解説解説

ユーザー匿名ユーザーである場合、そのユーザーカスタム プロファイル実装プロパティアクセスできるかどうか識別するには、SettingsAllowAnonymousAttribute クラス使用されます。匿名ユーザー識別有効にする方法については、anonymousIdentification 構成要素についてのドキュメント参照してください

プロファイル プロパティに対して SettingsAllowAnonymousAttribute指定されていない場合、そのプロファイル プロパティへの匿名アクセス許可されません。

カスタム プロファイル実装は ProfileBase 抽象クラスから継承したクラスであり、profile 構成要素指定されていないユーザー プロファイルプロパティ定義しますアプリケーションの Web.config ファイルにあるカスタム ユーザー プロファイルの型は、次の例に示すように、profile 構成要素inherits 属性使用して指定できます

<configuration>

<connectionStrings>

<add

name="SqlServices"

connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=aspnetdb;" />

</connectionStrings>

<system.web>

<authentication mode="Forms" >

<forms

loginUrl="login.aspx"

name=".ASPXFORMSAUTH" />

</authentication>

<authorization>

<deny users="?" />

</authorization>

<profile inherits="Samples.AspNet.Profile.EmployeeProfile"

defaultProvider="SqlProvider">

<providers>

<clear />

<add

name="SqlProvider"

type="System.Web.Profile.SqlProfileProvider"

connectionStringName="SqlServices"

description="SQL Profile Provider for Sample"/>

<add

name="EmployeeInfoProvider"

type="System.Web.Profile.SqlProfileProvider"

connectionStringName="SqlServices"

description="SQL Profile Provider for Employee Info"/>

</providers>

<properties>

<add name="GarmentSize" />

</properties>

</profile>

</system.web>

</configuration>

使用例使用例

ProfileBase から継承するクラス定義してカスタム プロファイル作成するコード例次に示しますカスタム プロファイルの型は、アプリケーションの Web.config ファイルにある profile 構成要素inherits 属性使用して指定します

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;
  }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.Profile.SettingsAllowAnonymousAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SettingsAllowAnonymousAttribute クラス」の関連用語

SettingsAllowAnonymousAttribute クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SettingsAllowAnonymousAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS