SlideShare a Scribd company logo
FortWayne .Net User Group – First presented on January 8, 2008
DeanWillson
Systemental, Inc.
About Me
 Work for Systemental, Inc as a Consultant
and Software Developer
 Software development to support Corporate
business process improvement since 2000
(Mostly to support Lean or Continuous
Improvement Initiatives)
 .Net since 2004
 Mfg. Eng. Technology degrees from Ball
State University
 Certified Six Sigma Black Belt
Scope of presentation
 Conceptual review
 Provider Model
 Tools (development and maintenance)
 Code examples
 Login Controls – Declarative Control Templates
 Install/Config, Aspnetdb
 Web.config settings
 Code-behind User.IsInRole
 Miscellaneous
 Global.asax populate IPrincipal
.Net Security Providers
 Prebuilt Membership and Role Providers for
managing security (and personalization).
Built-in providers:
 SQL Server
 SQL Express (used during presentation)
 Active Directory
 Provider based so you can create your own
Custom providers (MySQL, XML, Custom)
Tools – Development & Maintenance
 Development
 Login Controls
 CreateUserWizard
 Login, LoginView, LoginStatus, LoginName
 PasswordRecovery, ChangePassword
 Maintenance
 WSAT – Web Site Administration Tool (Visual
Studio: Website  ASP.Net Configuration)
 Roll-Your-Own admin
 Peter Kellner’s Membership Editor
Code Samples
 NUFWStarting website
 Initial project with Gridviews for two different roles HR and Sales (in
separate Panels)
 Objective is to add login and role based security functionality for the two
roles
 NUFWFinished website
 After adding login and role based security (added during presentation
 NUFWAdv website
 Showed how to install the aspnetdb Membership database to another
existing database (AdventureWorks) then use it. More like a production
deployment scenario. Note changes to connection string.
 Shows use of global.asax to populate Roles into GenericPrincipal from
an XML file while using the Membership db for the User Authentication
Web.config settings – con strings
Application App_Data/aspnetdb.mdf (from the machine.config):
<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|
DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
If using SQL Server (full version or custom db/connection):
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=(local);Initial
Catalog=aspnetdb;User ID=USER;Password=PASS"
providerName="System.Data.SqlClient" />
</connectionStrings>
Web.config –Authentication, Authorization
<roleManager enabled="true" cookieTimeout="5000000"
createPersistentCookie="true" />
(from machine.config):
<roleManager>
<providers>
<add name="AspNetSqlRoleProvider“
connectionStringName="LocalSqlServer" applicationName="/"
type="System.Web.Security.SqlRoleProvider, ..." />
</providers>
</roleManager>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="Default.aspx"></forms>
</authentication>
Web.config – restrict access
<system.web>
<authorization>
<allow roles="Admin"/>
<deny users="*,?"/>
</authorization>
</system.web>
Custom Install Membership Database
aspnetdb
 Separate Membership database to be used by
entire server
 Add Membership to an existing database
 C:WINDOWSMicrosoft.NETFrameworkv2.0.5
0727aspnet_regsql.exe
Wizard – add membership DDL
 C:WINDOWSMicrosoft.NETFramework
v2.0.50727aspnet_regsql.exe –W
Next
Pick authentication method
Almost there
Done
Before and After the Wizard
Launch WSAT
WSAT – Web Site Admin Tool
Select Authentication type
Users, Roles, Access Rules
References
 ASP.NET 2.0 Anthology Sitepoint 2007
 ASP.Net 2.0 Membership, Roles, Forms Authentication, and
Security Resources by Scott Guthrie
http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-
Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-
and-Security-Resources-.aspx
 Peter Kellner’s Membership Editor
 http://msdn2.microsoft.com/en-us/library/aa478958.aspx
 Introducing Microsoft Visual Basic 2005 For Developers Microsoft
Press 2005
 http://www.odetocode.com/Articles/428.aspx
 Security for Microsoft Visual Basic .Net Microsoft Press 2003
Thank you!
 Websites
 http://www.systemental.com
 http://www.LeanProjectManager.com
 Blog
 http://dean-o.blogspot.com/
 http://practicalhoshin.blogspot.com
 Twitter
 @deanwillson
 Email
 dean@systemental.com
AD Provider
<connectionStrings>
<add name="ADConnectionString"
connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdo
main,DC=test,DC=com" />
</connectionStrings>
<authorization>
<membership defaultProvider="MyADMembershipProvider"> <providers>
<add name="MyADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADConnectionString"
connectionUsername="testdomainadministrator"
connectionPassword="password"/>
</providers> </membership> </authorization>
Finished

More Related Content

PPTX
Partially Contained Databases
PPTX
SQLite database in android
PPTX
SQLite - Overview
PPTX
Query Store and live Query Statistics
PPT
JDBC Tutorial
PPTX
PPT
Sqlite
PPTX
Partially Contained Databases
SQLite database in android
SQLite - Overview
Query Store and live Query Statistics
JDBC Tutorial
Sqlite

What's hot (20)

PPT
Java database connectivity
PPTX
Writing simple web services in java using eclipse editor
PPTX
Jdbc in servlets
PPTX
JDBC ppt
PPTX
Kaashiv SQL Server Interview Questions Presentation
PDF
SQLite 3
PPTX
Sqlite
PPTX
Android Training (Storing data using SQLite)
PDF
Ada for Web Development
PPTX
Java- JDBC- Mazenet Solution
PPTX
Using sqlite database in android with sqlite manager browser add ons
PPSX
JDBC: java DataBase connectivity
PDF
Introduction to SQLite: The Most Popular Database in the World
PPT
Less07 Users
PPTX
Spring database - part2
PPTX
Sql interview-question-part-6
Java database connectivity
Writing simple web services in java using eclipse editor
Jdbc in servlets
JDBC ppt
Kaashiv SQL Server Interview Questions Presentation
SQLite 3
Sqlite
Android Training (Storing data using SQLite)
Ada for Web Development
Java- JDBC- Mazenet Solution
Using sqlite database in android with sqlite manager browser add ons
JDBC: java DataBase connectivity
Introduction to SQLite: The Most Popular Database in the World
Less07 Users
Spring database - part2
Sql interview-question-part-6
Ad

Viewers also liked (15)

KEY
Authentication Using Twitter, Google, Facebook, And More
PDF
Addressing cyber security
PDF
E-RBAC Development - A Risk Based Security Architecture Approach
PPT
IT Infrastructure and Platforms
PPS
MIS - IT Infrastructure (Part I)
PPT
ITIL v3 Foundation Overview
KEY
Intro To Hadoop
PPT
It infrastructure hardware and software
PPTX
History of Business Intelligence
PPTX
Big Data & Hadoop Tutorial
PPTX
Hadoop introduction , Why and What is Hadoop ?
PPT
Big data ppt
PPTX
Big data and Hadoop
PPTX
What is Big Data?
PPTX
Big data ppt
Authentication Using Twitter, Google, Facebook, And More
Addressing cyber security
E-RBAC Development - A Risk Based Security Architecture Approach
IT Infrastructure and Platforms
MIS - IT Infrastructure (Part I)
ITIL v3 Foundation Overview
Intro To Hadoop
It infrastructure hardware and software
History of Business Intelligence
Big Data & Hadoop Tutorial
Hadoop introduction , Why and What is Hadoop ?
Big data ppt
Big data and Hadoop
What is Big Data?
Big data ppt
Ad

Similar to Implementing ASP.NET Role Based Security (20)

PPT
Saying goodbye to SQL Server 2000
PDF
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
PDF
Rediscovering Spring with Spring Boot(1)
PDF
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
PDF
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
PDF
Google App Engine
PPTX
SpringBootCompleteBootcamp.pptx
PPTX
SQL Server - High availability
PPT
Sql server basics
PPTX
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
PPTX
SharePoint Object Model, Web Services and Events
PPTX
2009 - NRW Conf: (ASP).NET Membership
PPT
Windows Azure and a little SQL Data Services
PPT
Road Show Asp Net
PPTX
Asp Net Advance Topics
PDF
Hands-On Lab: Improve large network visibility and operational efficiency wit...
PPTX
struts unit best pdf for struts java.pptx
PPTX
struts unit best pdf for struts java.pptx
PPTX
Java Database Connectivity (JDBC) ppt by Aamir Rafique.pptx
PPT
Data Mining for Developers
Saying goodbye to SQL Server 2000
Java Web Programming on Google Cloud Platform [1/3] : Google App Engine
Rediscovering Spring with Spring Boot(1)
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
Google App Engine
SpringBootCompleteBootcamp.pptx
SQL Server - High availability
Sql server basics
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
SharePoint Object Model, Web Services and Events
2009 - NRW Conf: (ASP).NET Membership
Windows Azure and a little SQL Data Services
Road Show Asp Net
Asp Net Advance Topics
Hands-On Lab: Improve large network visibility and operational efficiency wit...
struts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptx
Java Database Connectivity (JDBC) ppt by Aamir Rafique.pptx
Data Mining for Developers

More from Dean Willson (12)

PPTX
Intro to the Internet of Things using Netduino
PPTX
Index Reorganization and Rebuilding for Success
PPTX
Automating sql server daily health checks
PPTX
Visual Studio 2012 Productivity Tools
PPTX
Intro to Powershell
PDF
Continuous improvement in a professional organization
PDF
Database Source Control
PPTX
Career Transitions - Ball State University, Six Sigma Speakers Series
PPTX
Introduction to SQL Server 2008 Management Data Warehouse (MDW)
PPTX
Introduction to SSRS Report Builder
PDF
Data Mining with SQL Server 2005
PDF
Designing For Occasionally Connected Apps Slideshare
Intro to the Internet of Things using Netduino
Index Reorganization and Rebuilding for Success
Automating sql server daily health checks
Visual Studio 2012 Productivity Tools
Intro to Powershell
Continuous improvement in a professional organization
Database Source Control
Career Transitions - Ball State University, Six Sigma Speakers Series
Introduction to SQL Server 2008 Management Data Warehouse (MDW)
Introduction to SSRS Report Builder
Data Mining with SQL Server 2005
Designing For Occasionally Connected Apps Slideshare

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Approach and Philosophy of On baking technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation theory and applications.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
The AUB Centre for AI in Media Proposal.docx
Per capita expenditure prediction using model stacking based on satellite ima...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Approach and Philosophy of On baking technology
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectral efficient network and resource selection model in 5G networks
Encapsulation theory and applications.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding

Implementing ASP.NET Role Based Security

  • 1. FortWayne .Net User Group – First presented on January 8, 2008 DeanWillson Systemental, Inc.
  • 2. About Me  Work for Systemental, Inc as a Consultant and Software Developer  Software development to support Corporate business process improvement since 2000 (Mostly to support Lean or Continuous Improvement Initiatives)  .Net since 2004  Mfg. Eng. Technology degrees from Ball State University  Certified Six Sigma Black Belt
  • 3. Scope of presentation  Conceptual review  Provider Model  Tools (development and maintenance)  Code examples  Login Controls – Declarative Control Templates  Install/Config, Aspnetdb  Web.config settings  Code-behind User.IsInRole  Miscellaneous  Global.asax populate IPrincipal
  • 4. .Net Security Providers  Prebuilt Membership and Role Providers for managing security (and personalization). Built-in providers:  SQL Server  SQL Express (used during presentation)  Active Directory  Provider based so you can create your own Custom providers (MySQL, XML, Custom)
  • 5. Tools – Development & Maintenance  Development  Login Controls  CreateUserWizard  Login, LoginView, LoginStatus, LoginName  PasswordRecovery, ChangePassword  Maintenance  WSAT – Web Site Administration Tool (Visual Studio: Website  ASP.Net Configuration)  Roll-Your-Own admin  Peter Kellner’s Membership Editor
  • 6. Code Samples  NUFWStarting website  Initial project with Gridviews for two different roles HR and Sales (in separate Panels)  Objective is to add login and role based security functionality for the two roles  NUFWFinished website  After adding login and role based security (added during presentation  NUFWAdv website  Showed how to install the aspnetdb Membership database to another existing database (AdventureWorks) then use it. More like a production deployment scenario. Note changes to connection string.  Shows use of global.asax to populate Roles into GenericPrincipal from an XML file while using the Membership db for the User Authentication
  • 7. Web.config settings – con strings Application App_Data/aspnetdb.mdf (from the machine.config): <connectionStrings> <add name="LocalSqlServer" connectionString="data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=| DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings> If using SQL Server (full version or custom db/connection): <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;User ID=USER;Password=PASS" providerName="System.Data.SqlClient" /> </connectionStrings>
  • 8. Web.config –Authentication, Authorization <roleManager enabled="true" cookieTimeout="5000000" createPersistentCookie="true" /> (from machine.config): <roleManager> <providers> <add name="AspNetSqlRoleProvider“ connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, ..." /> </providers> </roleManager> <authentication mode="Forms"> <forms loginUrl="Login.aspx" defaultUrl="Default.aspx"></forms> </authentication>
  • 9. Web.config – restrict access <system.web> <authorization> <allow roles="Admin"/> <deny users="*,?"/> </authorization> </system.web>
  • 10. Custom Install Membership Database aspnetdb  Separate Membership database to be used by entire server  Add Membership to an existing database  C:WINDOWSMicrosoft.NETFrameworkv2.0.5 0727aspnet_regsql.exe
  • 11. Wizard – add membership DDL  C:WINDOWSMicrosoft.NETFramework v2.0.50727aspnet_regsql.exe –W
  • 12. Next
  • 15. Done
  • 16. Before and After the Wizard
  • 18. WSAT – Web Site Admin Tool
  • 21. References  ASP.NET 2.0 Anthology Sitepoint 2007  ASP.Net 2.0 Membership, Roles, Forms Authentication, and Security Resources by Scott Guthrie http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0- Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_- and-Security-Resources-.aspx  Peter Kellner’s Membership Editor  http://msdn2.microsoft.com/en-us/library/aa478958.aspx  Introducing Microsoft Visual Basic 2005 For Developers Microsoft Press 2005  http://www.odetocode.com/Articles/428.aspx  Security for Microsoft Visual Basic .Net Microsoft Press 2003
  • 22. Thank you!  Websites  http://www.systemental.com  http://www.LeanProjectManager.com  Blog  http://dean-o.blogspot.com/  http://practicalhoshin.blogspot.com  Twitter  @deanwillson  Email  dean@systemental.com
  • 23. AD Provider <connectionStrings> <add name="ADConnectionString" connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdo main,DC=test,DC=com" /> </connectionStrings> <authorization> <membership defaultProvider="MyADMembershipProvider"> <providers> <add name="MyADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADConnectionString" connectionUsername="testdomainadministrator" connectionPassword="password"/> </providers> </membership> </authorization>

Editor's Notes

  • #2: updated 6/10/2010 to add SQL Server membership provider ddl wizard screenshots