Although the Membership feature is technically a part of ASP.NET 2.0 and ASP.NET 3.5 (the feature exists in the System.Web.Security namespace and is physically located in System.Web.dll), you can use the Membership feature outside of ASP.NET. This means that you can call any of the functionality in the Membership feature from console applications, NT service applications, fat client applications (that is, Windows Forms apps), and so on. Although you will need to reference the appropriate ASP.NET namespace and assembly, beyond this requirement nothing special is needed to get Membership working outside of ASP.NET.
The Membership feature always requires at least Low trust to work. For ASP.NET applications, this means that you must run in Low trust or higher. For a non-ASP.NET application, the AspNetHostingPermission must be granted to the calling code with a level of Low or higher.
As an example of using the feature outside of ASP.NET, you can write a basic console application that creates MembershipUser instances. This can come in handy if you need to prepopulate the database for the SqlMembershipProvider. When you create a non-ASP.NET application, it must reference System.Web.dll. Figure 11-1 shows the proper reference for a console application set up in Visual Studio 2005.
Because the Membership feature has default settings ...