ProfileMigrateEventArgs クラス

定義

MigrateAnonymous クラスの ProfileModule イベントのデータを提供します。

public ref class ProfileMigrateEventArgs sealed : EventArgs
public sealed class ProfileMigrateEventArgs : EventArgs
type ProfileMigrateEventArgs = class
    inherit EventArgs
Public NotInheritable Class ProfileMigrateEventArgs
Inherits EventArgs
継承
ProfileMigrateEventArgs

次のコード例は、匿名認証を有効にするWeb.config ファイルと、 MigrateAnonymous ASP.NET アプリケーションの Global.asax ファイルに含まれるイベントを示しています。

次のコード例は、匿名ユーザーをサポートする匿名 ID とプロファイル プロパティを有効にするWeb.config ファイルを示しています。

<configuration>  
  <system.web>  
    <authentication mode="Forms" >  
      <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" />  
    </authentication>  

    <AnonymousIdentification enabled="true" />  

    <profile enabled="true" defaultProvider="AspNetSqlProvider">  
      <properties>  
        <add name="ZipCode" allowAnonymous="true" />  
        <add name="CityAndState" allowAnonymous="true" />  
        <add name="StockSymbols" type="System.Collections.ArrayList" allowAnonymous="true" />  
      </properties>  
    </profile>  
  </system.web>  
</configuration>  

次のコード例は、 MigrateAnonymous ASP.NET アプリケーションの Global.asax ファイルに含まれるイベントを示しています。 イベントは MigrateAnonymous 、匿名プロファイルから現在のユーザーのプロファイルにプロファイル プロパティの値をコピーします。

public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args)
{
  ProfileCommon anonymousProfile = Profile.GetProfile(args.AnonymousID);

  Profile.ZipCode = anonymousProfile.ZipCode;
  Profile.CityAndState = anonymousProfile.CityAndState;
  Profile.StockSymbols = anonymousProfile.StockSymbols;

  ////////
  // Delete the anonymous profile. If the anonymous ID is not 
  // needed in the rest of the site, remove the anonymous cookie.

  ProfileManager.DeleteProfile(args.AnonymousID);
  AnonymousIdentificationModule.ClearAnonymousIdentifier(); 

  // Delete the user row that was created for the anonymous user.
  Membership.DeleteUser(args.AnonymousID, true);

}
Public Sub Profile_OnMigrateAnonymous(sender As Object, args As ProfileMigrateEventArgs)
  Dim anonymousProfile As ProfileCommon = Profile.GetProfile(args.AnonymousID)

  Profile.ZipCode = anonymousProfile.ZipCode
  Profile.CityAndState = anonymousProfile.CityAndState
  Profile.StockSymbols = anonymousProfile.StockSymbols

  ''''''''
  ' Delete the anonymous profile. If the anonymous ID is not 
  ' needed in the rest of the site, remove the anonymous cookie.

  ProfileManager.DeleteProfile(args.AnonymousID)
  AnonymousIdentificationModule.ClearAnonymousIdentifier()

  ' Delete the user row that was created for the anonymous user.
  Membership.DeleteUser(args.AnonymousID, True)
End Sub

注釈

オブジェクトは ProfileMigrateEventArgs 、 クラスの イベントに MigrateAnonymous イベント情報を ProfileModule 提供します。 オブジェクトは ProfileMigrateEventArgs 、現在の要求の への HttpContext アクセスと、 プロパティ内の匿名プロファイルの匿名ユーザー識別子へのアクセスを AnonymousID 提供します。

アプリケーションを MigrateAnonymous 匿名で使用しているユーザーがログインしたときに、 イベントを使用して、匿名プロファイルから認証済みプロファイルにプロファイル プロパティの値をコピーできます。

ユーザー プロファイルが有効になっているアプリケーションが開始されると、ASP.NET は クラスから継承する 型 ProfileCommonの新しいクラスを ProfileBase 作成します。 クラスが ProfileCommon 生成されると、Web.config ファイルで指定されたプロファイル プロパティに基づいて、 GetProfile ユーザー名に基づいてオブジェクトを ProfileCommon 取得できるメソッドが追加されます。 現在のプロファイルの GetProfile メソッドを使用して、匿名プロファイルのプロパティ値を取得できます。 その後、匿名プロパティの値を、認証されたユーザーの現在のプロファイルにコピーできます。

コンストラクター

ProfileMigrateEventArgs(HttpContext, String)

ProfileMigrateEventArgs クラスのインスタンスを作成します。

プロパティ

AnonymousID

プロファイル プロパティ値の移行元の匿名プロファイルの匿名識別子を取得します。

Context

現在の要求に対する HttpContext を取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください