How can I add the MembershipProvider class to my .NET 4.0 project in VS 2010 B2?
I want to customize a MembershipProvider, but I cannot without adding this class. Please guide me through this process.
The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services.
To configure SQLMembershipProvider, first you need to configure your database. Leave the default selection "Configure SQL Server for application services" and click Next again. Enter the server name, Select SQL Server authentication and enter user id and password as in the following figure.
Web. Security namespace includes a class named MembershipUser that defines the basic attributes of a membership user and that a membership provider uses to represent individual users.
Interesting. However, build errors are your friend ;)
Attempting to build a class library built as you describe, I get the following build error:
The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Following the instructions (adding a reference to System.Web.ApplicationServices) allows me to carry on as expected.
The MembershipProvider abstract class is part of the System.Web.ApplicationServices namespace in the .net 4.0 Framework. Add a reference to that assembly and it should solve the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With