Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing RoleProvider in a class library

I'm trying to create a custom role provider in a class library, and for some reason I can't reference System.Web.Security.RoleProvider.

I have added a reference to System.Web in the project, yet still no luck. Is there a reason why I can't do this?

like image 975
Chris Avatar asked Dec 18 '11 12:12

Chris


1 Answers

You need to reference the assembly System.Web.ApplicationServices.dll. The RoleProvider class is not defined in System.Web.dll.

In this cases and when in doubt check the MSDN page for the associated class and at the top of the page you can see in what namespace and assembly it is defined.

For the RoleProvider class you have:

Namespace: System.Web.Security

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

like image 184
João Angelo Avatar answered Nov 14 '22 23:11

João Angelo