Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I was looking for set custom authentication I found we must set role to user
like this
C#
Roles.AddRoleToUser(userName, RoleName)

and found that I must put configuration in my webconfig
C#
<roleManager enabled="true" defaultProvider="DefaultRoleProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>


but I have Configuration Error when run application when add those lines in webconfig!

and when remove roleManager from webconfig
and try to add role to user
I got
C#
Unable to connect to SQL Server database


any help?
Posted
Updated 10-Jan-16 21:33pm
v2

1 solution

Hello,

Please follow the below link:
Secure Applications Using Authentication and Authorization | The ASP.NET Site[^]
Here you can find the guide to implement in a proper way, Rles in MVC3.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900