Developing Web Applications Using Microsoft Visual Studio 2008
Developing Web Applications Using Microsoft Visual Studio 2008
Using
Microsoft® Visual
Studio® 2008
Module 16: Securing a Microsoft ASP.NET
Web Application
• Web Application Security Overview
• Windows-Based Authentication
• Forms-Based Authentication
Lesson: Web Application Security Overview
• Authentication vs. Authorization
• Authorization:
Given the authentication credentials supplied, determines the
right to access a resource
Assign authorization by user name or by role
What Are the ASP.NET Authentication Methods?
• Windows-based authentication
Relies on the Windows operating system and IIS
User requests a secure Web page and the request goes
through IIS
After credentials are verified by IIS, the secure Web page is
returned
• Forms-based authentication
Unauthenticated requests are redirected to an HTML form
User provides credentials and submits the HTML form
After credentials are verified, an authentication cookie is
issued
Comparing the ASP.NET Authentication Methods
Security
Mechanisms Mechanisms
Level
Anonymous None No authentication occurs
<system.web>
<authentication mode="Windows" />
</system.web>
[Visual C#]
userLabel.Text = User.Identity.Name;
userTypeLabel.Text = User.Identity.AuthenticationType;
userAuthenticatedLabel.Text = User.Identity.IsAuthenticated;
[Visual Basic]
userLabel.Text = User.Identity.Name
userTypeLabel.Text = User.Identity.AuthenticationType
userAuthenticatedLabel.Text = User.Identity.IsAuthenticated
Lesson: Forms-Based Authentication
• Overview of Forms-Based Authentication
1 2
ASP.NET Forms
IIS authentication
Authorized
Username
6
Access denied Someone 4
Authorized
Requested
7 secure
Authentication
cookie page
5
Multimedia: Forms-Based Authentication
Enabling Forms-Based Authentication
33 Set up authorization
Logon information
Master Page
Logon Page benefitsMaster.master
login.aspx
Benefits Lab Web
Home Page Application
ASPState
Default.aspx Page Header
header.ascx
Menu Component
Registration Benefits.cs or Benefits.vb
register.aspx TempDB
Web.
config
Prospectus
prospectus.aspx Doctors User Control XML Web
LINQ to SQL doctors.aspx nameDate.ascx Service
Classes DentalService1.asmx
Doctors.dbml
Doctors Dentists
XML Files
Lab Review
Review Questions
• How can you deny access to anonymous users for certain
Web pages?
• How can you configure Forms-based authentication in the
web.config file?
• How can you build a logon form for a Web site?
• Best Practices
• Tools
Course Evaluation