This documentation is archived and is not being maintained.

ProfileBase.Create Method (String, Boolean)

Used by ASP.NET to create an instance of a profile for the specified user name. Takes a parameter indicating whether the user is authenticated or anonymous.

Namespace:  System.Web.Profile
Assembly:  System.Web (in System.Web.dll)

public static ProfileBase Create(
	string username,
	bool isAuthenticated


Type: System.String
The name of the user to create a profile for.
Type: System.Boolean
true to indicate the user is authenticated; false to indicate the user is anonymous.

Return Value

Type: System.Web.Profile.ProfileBase
A ProfileBase object that represents the profile for the specified user.


The enabled attribute of the profile section of the Web.config file is false.


The current hosting permission level is less than Medium.


A property type specified in the profile section of the Web.config file could not be created.


The allowAnonymous attribute for a property in the profile section of the Web.config file is set to true and the enabled attribute of the <anonymousIdentification> element is set to false.


The serializeAs attribute for a property in the profile section of the Web.config file is set to Binary and the IsSerializable property of the specified type returns false.


The name of a provider specified using the provider attribute of a profile property could not be found in the Providers collection.


The type specified for a profile property could not be found.


A profile property was specified with a name that matches a property name on the base class specified in the inherits attribute of the profile section.

The Create method creates and initializes a new profile instance and is useful for applications that use a custom profile object or manage user profiles in a non-ASP.NET environment.

This overload of the Create method can be used to create a profile for an authenticated user or an anonymous user.

The following code example creates an instance of a custom profile object, sets a property, and saves the profile to the data source.

MyCustomProfile profile = (MyCustomProfile)ProfileBase.Create("username", true);
profile.ZipCode = "98052";

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.