ProfileMigrateEventArgs クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
MigrateAnonymous クラスの ProfileModule イベントのデータを提供します。
public ref class ProfileMigrateEventArgs sealed : EventArgs
public sealed class ProfileMigrateEventArgs : EventArgs
type ProfileMigrateEventArgs = class
inherit EventArgs
Public NotInheritable Class ProfileMigrateEventArgs
Inherits EventArgs
- 継承
例
次のコード例は、匿名認証を有効にするWeb.config ファイルと、MigrateAnonymousASP.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>
次のコード例は、MigrateAnonymousASP.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) |