Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ProfileAutoSaveEventArgs.ContinueWithProfileAutoSave Property

Gets or sets a value indicating whether the ProfileModule will automatically save the user profile.

Namespace: System.Web.Profile
Assembly: System.Web (in system.web.dll)
public bool ContinueWithProfileAutoSave { get; set; }
/** @property */
public boolean get_ContinueWithProfileAutoSave ()

/** @property */
public void set_ContinueWithProfileAutoSave (boolean value)

public function get ContinueWithProfileAutoSave () : boolean

public function set ContinueWithProfileAutoSave (value : boolean)

Not applicable.

Property Value

true if the ProfileModule will automatically save the user profile; otherwise, false. The default is true.

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

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

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

The following code example shows the ProfileAutoSaving event included in the Global.asax file for an ASP.NET application.

public void Profile_ProfileAutoSaving(object sender, ProfileAutoSaveEventArgs args)
{
  if (Profile.Cart.HasChanged)
    args.ContinueWithProfileAutoSave = true;
  else
    args.ContinueWithProfileAutoSave = false;
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.