Where is System.Web.Security.MembershipProvider?
Asked Answered
S

1

21

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.

Selectman answered 22/6, 2012 at 17:25 Comment(0)
C
39

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)

Creole answered 22/6, 2012 at 17:31 Comment(1)
Resharper tries to suggest adding System.Web.Security, to which it adds the code, but doesn't find the reference. Manaully adding the reference to System.Web.ApplicationServices works a treat. Thank you.Occiput

© 2022 - 2024 — McMap. All rights reserved.