System.Web.Profile.ProfileAutoSaveEventHandler Delegate

Represents the method that will handle the ProfileModule.ProfileAutoSaving event of a System.Web.Profile.ProfileModule.

Syntax

public delegate void ProfileAutoSaveEventHandler (object sender, ProfileAutoSaveEventArgs e)

Parameters

sender
Documentation for this section has not yet been entered.
e
Documentation for this section has not yet been entered.

Remarks

The System.Web.Profile.ProfileAutoSaveEventHandler delegate is defined for the ProfileModule.ProfileAutoSaving event of the System.Web.Profile.ProfileModule class. You can access the ProfileModule.ProfileAutoSaving event of the System.Web.Profile.ProfileModule class in the Global.asax file for your ASP.NET application, as shown in the example for this topic. The ProfileModule.ProfileAutoSaving event is raised at the end of page execution if the ProfileManager.AutomaticSaveEnabled property is true.

The System.Configuration.SettingsBase.Save method automatically determines whether properties that are made up of primitive types, strings, or DateTime objects have been changed, by checking the System.Configuration.SettingsPropertyValue.IsDirty property value for each System.Configuration.SettingsPropertyValue in the user profile. However, the System.Configuration.SettingsBase.Save method cannot explicitly determine whether a custom class has changed. You can handle the ProfileModule.ProfileAutoSaving event to determine whether a custom object has been modified and to continue with the automatic save for modified objects and cancel the automatic save if no objects have been modified.

To cancel the automatic profile save operation, set the ProfileAutoSaveEventArgs.ContinueWithProfileAutoSave property to false in the ProfileModule.ProfileAutoSaving event; otherwise, set the ProfileAutoSaveEventArgs.ContinueWithProfileAutoSave property to true.

There may be multiple subscribers to the ProfileModule.ProfileAutoSaving event. The System.Web.Profile.ProfileModule will use the last value that the ProfileAutoSaveEventArgs.ContinueWithProfileAutoSave property is set to. As a result, it is recommended that you explicitly set the ProfileAutoSaveEventArgs.ContinueWithProfileAutoSave property in the ProfileModule.ProfileAutoSaving event, regardless of whether you are canceling or continuing with the automatic save, as you may need to overwrite the value set by an earlier subscriber.

Requirements

Namespace: System.Web.Profile
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0