ProfileMigrateEventHandler Temsilci
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
sınıfının olayını MigrateAnonymous işleyecek ProfileModule yöntemi temsil eder.
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)
Parametreler
- sender
- Object
Olayı ProfileModule tetikleyen MigrateAnonymous .
ProfileMigrateEventArgs Olay verilerini içeren bir.
Örnekler
Aşağıdaki kod örneklerinde anonim kimlik doğrulamasını MigrateAnonymous etkinleştiren bir Web.config dosyası ve ASP.NET bir uygulama için Global.asax dosyasına dahil edilen olay gösterilmektedir.
Aşağıdaki kod örneğinde anonim kullanıcıları destekleyen anonim tanımlama ve profil özelliklerini etkinleştiren bir Web.config dosyası gösterilmektedir.
<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>
Aşağıdaki kod örneği, bir ASP.NET uygulamasının Global.asax dosyasına dahil edilen olayı gösterir MigrateAnonymous . Olay, MigrateAnonymous profil özelliği değerlerini anonim profilden geçerli kullanıcının profiline kopyalar.
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
Açıklamalar
Temsilci ProfileMigrateEventHandler , sınıfın MigrateAnonymous olayı ProfileModule için tanımlanır. Bu konudaki örnekte gösterildiği gibi ASP.NET uygulamanızın Global.asax dosyasındaki MigrateAnonymous sınıfının ProfileModule olayına erişebilirsiniz.
Uygulama oturumunuzu anonim olarak kullanan biri oturum açtığında, anonim profilden kimliği doğrulanmış bir profile profil özelliği değerlerini kopyalamak için olayını kullanabilirsiniz MigrateAnonymous .
Kullanıcı profili etkinleştirilmiş bir uygulama başlatıldığında, ASP.NET sınıfından ProfileCommon devralan yeni bir tür ProfileBasesınıfı oluşturur.
ProfileCommon Sınıf oluşturulduğunda, Web.config dosyasında belirtilen profil özelliklerine göre, kullanıcı GetProfile adına göre bir nesne almanıza olanak tanıyan bir ProfileCommon yöntem eklenir. Anonim profilin GetProfile özellik değerlerini almak için geçerli profilin yöntemini kullanabilirsiniz. Anonim özellik değerleri daha sonra kimliği doğrulanmış kullanıcının geçerli profiline kopyalanabilir.
Uzantı Metotları
| Name | Description |
|---|---|
| GetMethodInfo(Delegate) |
Belirtilen temsilci tarafından temsil edilen yöntemi temsil eden bir nesnesi alır. |