ProfileMigrateEventHandler 대리자

정의

ProfileModule 클래스의 MigrateAnonymous 이벤트를 처리할 메서드를 나타냅니다.

public delegate void ProfileMigrateEventHandler(System::Object ^ sender, ProfileMigrateEventArgs ^ e);
public delegate void ProfileMigrateEventHandler(object sender, ProfileMigrateEventArgs e);
type ProfileMigrateEventHandler = delegate of obj * ProfileMigrateEventArgs -> unit
Public Delegate Sub ProfileMigrateEventHandler(sender As Object, e As ProfileMigrateEventArgs)

매개 변수

sender
Object

ProfileModule 이벤트를 발생시킨 MigrateAnonymous입니다.

e
ProfileMigrateEventArgs

이벤트 데이터를 포함하는 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

설명

ProfileMigrateEventHandler 대리자에 대해 정의 된 합니다 MigrateAnonymous 이벤트는 ProfileModule 클래스. 액세스할 수 있습니다 합니다 MigrateAnonymous 의 이벤트는 ProfileModule 이 항목의 예제와 같이 ASP.NET 애플리케이션의 Global.asax 파일에서 클래스입니다.

사용할 수는 MigrateAnonymous 프로필 속성을 복사 하는 이벤트 값 익명 프로필에서 인증된 된 프로필에 익명으로 사용 하 여 애플리케이션 사용자가 로그인 할 때입니다.

사용자 프로필을 사용 하는 애플리케이션 시작 되 면 ASP.NET 형식의 새 클래스를 만듭니다 ProfileCommon에서 상속 되는 ProfileBase 클래스입니다. 경우는 ProfileCommon 클래스 Web.config 파일에 지정 된 프로필 속성을 기반으로 생성 되는 GetProfile 검색할 수 있도록 메서드가 추가 됩니다를 ProfileCommon 개체 이름을 기반으로 사용자. 사용할 수는 GetProfile 메서드의 현재 프로필을 익명 프로필의 속성 값을 검색 합니다. 그런 다음 인증된 된 사용자에 대 한 현재 프로필에 익명 속성 값을 복사할 수 있습니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보