Download presentation
Presentation is loading. Please wait.
Published byNigel Andrews Modified over 9 years ago
1
Vinay Dhareshwar
2
Introduction Membership Service Login Controls Role Management Service 2
3
Most business applications require role- based security. Role management lets you create groups of users as a unit Roles give flexibility to change permissions and add and remove users. Each Web page in the Web application can be assigned a security level As you define more access rules for your application, roles become a more convenient way to apply the changes to groups of users. 3
4
Manages users and credentials Simplifies forms authentication Provider-based for flexible data storage 4
5
Membership API Membership Data Controls LoginLoginLoginStatusLoginStatusLoginViewLoginView Other Membership Providers Providers Membership Providers MembershipMembershipMembershipUserMembershipUser SqlMembershipProviderSqlMembershipProvider OtherControlsOtherControls SQL Server Other Data Stores SQL Server Express 5
7
try { Membership.CreateUser ("Jeff", "imbatman!", "jeff@microsoft.com"); } catch (MembershipCreateUserException e) { // Find out why CreateUser failed switch (e.StatusCode) { case MembershipCreateStatus.DuplicateUsername:... case MembershipCreateStatus.DuplicateEmail:... case MembershipCreateStatus.InvalidPassword:... default:... } 7
8
Represents individual users registered in the membership data store Returned by Membership methods such as GetUser and CreateUser 8
10
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow = "00:15:00" hashAlgorithmType = "[SHA1|MD5]" >... 10
12
12
13
Displays content differently to different users depending on: ◦ Whether user is authenticated ◦ If user is authenticated, the role memberships he or she is assigned Template-driven ◦ ◦ and 13
14
... 14
15
Role-based security in a box Simplifies adding role-based security to sites that employ forms authentication Provider-based for flexible data storage 15
16
Roles API Roles Data SQL Server Other Data Stores Controls LoginLoginLoginStatusLoginStatusLoginViewLoginView Other Role Providers Role Providers RolesRoles SqlRoleProviderSqlRoleProvider SQL Server Express OtherControlsOtherControls 16
17
Provides static methods for performing key role management tasks Includes read-only static properties for acquiring data about provider settings 17
19
if (!Roles.RoleExists ("Developers")) { Roles.CreateRole ("Developers"); } string name = Membership.GetUser ().Username; // Get current user Roles.AddUserToRole (name, "Developers"); // Add current user to role 19
20
<roleManager enabled="[true|false]" defaultProvider="AspNetSqlRoleProvider" createPersistentCookie="[true|false]" cacheRolesInCookie="[true|false]" cookieName=".ASPXROLES" cookieTimeout="00:30:00" cookiePath="/" cookieRequireSSL="[true|false]" cookieSlidingExpiration="[true|true]" cookieProtection="[None|Validation|Encryption|All]" domain="" maxCachedResults="25" >... 20
21
Role management is provider-based Ships with three role providers: ◦ AuthorizationStoreRoleProvider (Authorization Manager, or "AzMan") ◦ SqlRoleProvider (SQL Server) ◦ WindowsTokenRoleProvider (Windows) Use custom providers for other data stores 21
22
<add applicationName="/" connectionStringName="LocalSqlServer" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web,..." /> 22
23
23
24
http://www.c- sharpcorner.com/UploadFile/praveenalwar/PraveenAlwar072020 06064726AM/PraveenAlwar.aspx http://www.c- sharpcorner.com/UploadFile/praveenalwar/PraveenAlwar072020 06064726AM/PraveenAlwar.aspx http://msdn.microsoft.com/en-us/library/5k850zwb.aspx http://msdn.microsoft.com/en-us/library/5k850zwb.aspx http://oudinia.blogspot.com/2007/11/aspnet-20-security-role- management.html http://oudinia.blogspot.com/2007/11/aspnet-20-security-role- management.html http://www.codedigest.com/Articles/ASPNET/78_LoginView_Con trols_with_Roles_in_ASPNet_20.aspx http://www.codedigest.com/Articles/ASPNET/78_LoginView_Con trols_with_Roles_in_ASPNet_20.aspx http://msdn.microsoft.com/en-us/library/aa478958.aspx http://msdn.microsoft.com/en-us/library/aa478958.aspx http://download.microsoftvirtuallabs.com/download/8/a/7/8a7 1365b-4c80-4e60-8185- 8f12f59bf1d4/ASP.NET2.0MembershipLoginControlsandRoleMan agement.pdf http://download.microsoftvirtuallabs.com/download/8/a/7/8a7 1365b-4c80-4e60-8185- 8f12f59bf1d4/ASP.NET2.0MembershipLoginControlsandRoleMan agement.pdf 24
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.