Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

ASP.NET/Roles

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

A role is a group of users who are uniquely identified by the set of privileges they are given. A typical website has three roles: Administrator Power User User An administrator has all privileges over the particular site while power user and ordinary users don't have. Creation of Roles Roles can be created in various ways. The typical process of role creation involves using the Role Manager tag in Web.config Example <configuration> <connectionStrings> <add name="SqlServices" connectionString="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=SSPI;" /> </connectionStrings> <system.web> <authentication mode="Forms" > <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH" /> </authentication> <authorization> <deny users="?" /> <allow roles="Administrators" /> <deny users="*" /> </authorization> <membership defaultProvider="AspNetSqlProvider" userIsOnlineTimeWindow="15"> </membership> <roleManager defaultProvider="SqlProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="true" cookieSlidingExpiration="true" cookieProtection="All" > <providers> <clear /> <add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="SqlServices" applicationName="SampleApplication" /> </providers> </roleManager> </system.web> </configuration> Roles can also be assigned or modified programmatically using the Role class. Using the Website Administration Tool Roles can be created in .NET 2.0 using the ASP.NET Website Administration tool. This tool is available in the Solution Explorer toolbar. The tool allows the user to change: Security settings Application Configuration Provider Configuration A few snapshots of the tool are available below. These snapshots are self-explanatory: Image:WebSite Admin Home.JPG Image:Website Admin Security.JPG Image:Website Admin Security Roles.JPG References Role Class in C#, MSDN site