ProfileModule Sınıf

Tanım

Kullanıcı profili ve profil olaylarının oluşturulmasını yönetir. Bu sınıf devralınamaz.

public ref class ProfileModule sealed : System::Web::IHttpModule
public sealed class ProfileModule : System.Web.IHttpModule
type ProfileModule = class
    interface IHttpModule
Public NotInheritable Class ProfileModule
Implements IHttpModule
Devralma
ProfileModule
Uygulamalar

Örnekler

Aşağıdaki örnekte anonim kullanıcıları destekleyen anonim kimlik 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

Kullanıcı profili etkinleştirildiğinde, ASP.NET ProfileModule kullanıcı profilini oluşturmak ve geçerli HttpContextözelliğinin Profile içinde depolamak için kullanır.

, ProfileModule uygulamanızda kimlik doğrulamasını yapılandırmak için işleyebileceğiniz aşağıdaki olayları kullanıma sunar:

  • Anonim MigrateAnonymous bir kullanıcı oturum açtığında profil ayarlarını anonim profilden kimliği doğrulanmış bir profile geçirmek için olay.

  • Olay Personalize , kullanıcı profilinin nasıl oluşturulduğunu özelleştirmek için.

  • ProfileAutoSaving özelliği olarak ayarlandığında kullanıcı profilinin nasıl kaydedileceğini AutomaticSaveEnabled denetlemek için trueolayı.

Kullanıcı profilini etkinleştirme hakkında bilgi için bkz. profil Öğesi (ASP.NET Ayarlar Şeması).

Oluşturucular

ProfileModule()

ProfileModule sınıfının yeni bir örneğini başlatır.

Yöntemler

Dispose()

ProfileModule tarafından kullanılan tüm kaynakları serbest bırakır.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
Init(HttpApplication)

Bir ProfileModule nesne oluşturulduğunda başlatma kodunu çağırır.

MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Ekinlikler

MigrateAnonymous

Profil için anonim kullanıcı oturum açtığında gerçekleşir.

Personalize

Kullanıcı profili oluşturulmadan önce gerçekleşir.

ProfileAutoSaving

Otomatik profil kaydetme etkinleştirildiyse, sayfa yürütmenin sonunda gerçekleşir.

Şunlara uygulanır

Ayrıca bkz.