Where is System.Web.Security.MembershipProvider?

Naor picture Naor · Jun 22, 2012 · Viewed 15.9k times · Source

I have a library project that should be the base for several web applications. I am trying to implement System.Web.Security.MembershipProvider but for some reason Visual Studio cannot find it. It manages to find System.Web.Security.SqlMembershipProvider but not MembershipProvider.

Any idea why?

I am using Visual Studio 2010 with .NET 4.

Answer

Michael Liu picture Michael Liu · Jun 22, 2012

Starting in .NET 4, MembershipProvider is declared in System.Web.ApplicationServices.dll (strangely enough), so you need to add a reference to that assembly. In .NET 3.5 and earlier, MembershipProvider is declared in System.Web.dll.


Tip: To find out which assembly contains any .NET Framework class, just search for the class in MSDN Library. Here's what the MembershipProvider page for .NET 4 says:

Namespace: System.Web.Security
Assembly: System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)

And here's what the MembershipProvider page for .NET 3.5 says:

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