The type ‘System.Web.Security.MembershipUser’ is defined in an assembly that is not referenced

While converting website from .NET 3.5 into 4.0 framework, I got an error message as:
The type or namespace name ‘MembershipUser’ could not be found (are you missing a using directive or an assembly reference?)

Solution:

MembershipUser and Other Types used in ASP.NET membership have been moved from System.Web.dll to the new System.Web.ApplicationServices.dll assembly. The types were moved in order to resolve architectural layering dependencies between types in the client and in extended .NET Framework SKUs.

You can work around this problem by adding a reference in your class library project to System.Web.ApplicationServices.dll.

The following list shows the System.Web.Security types that were moved from System.Web.dll to System.Web.ApplicationServices.dll:
• System.Web.Security.MembershipCreateStatus
• System.Web.Security.Membership.CreateUserException
• System.Web.Security.MembershipPasswordException
• System.Web.Security.MembershipPasswordFormat
• System.Web.Security.MembershipProvider
• System.Web.Security.MembershipProviderCollection
• System.Web.Security.MembershipUser
• System.Web.Security.MembershipUserCollection
• System.Web.Security.MembershipValidatePasswordEventHandler
• System.Web.Security.ValidatePasswordEventArgs
• System.Web.Security.RoleProvider
• System.Web.Configuration.MembershipPasswordCompatibilityMode

 

– Mehul Kothari

www.radical-it-solutions.com

Leave a comment