I've enabled Roles
in my ASP.NET web application, but I'm slightly confused as to where they are being stored. In my old project, each Role would appea开发者_JAVA技巧r in the ASP.NET Roles table, and I could see them. However, in my new project, I can't see any Roles in the database table. The strange thing is, I can still use them (and the default Roles/Membership API) and everything works fine. Any ideas why they are not appearing the database table itself, and where they are actually being stored?
My web.config
file has this:
<roleManager enabled="true" />
Using the ASP.NET configuration tool, my default Role provider is AspNetSqlRoleProvider
.
Thanks Update I added this explicitly in my web.confg
<roleManager enabled="true" >
<providers>
<clear/>
<add connectionStringName="myDBConnectionString" name="AspNetSqlRoleProvider"/>
</providers>
</roleManager>
By default, it does use the local database unless the role provider points to a database using a different database connection.
If you setup the tables in your own custom database and not the ASPNETDB.mdf file, then you will have to setup a custom provider definition pointing to the SQLroleprovider, and provide a custom connection string reference to where the database is.
HTH.
In your asp.net membership database are two tables: aspnet_Roles contains the roles and aspnet_UsersInRoles contains the association of users with roles.
it will build it’s OWN database in the App_Data folder and create the required tables there
精彩评论