Chapter 8. Using the ASP.NET AJAX Authentication Service

One of the design goals of ASP.NET 2.0 was to reduce the time required to implement common web site tasks. Among these tasks are user and access management operations, including user login, terminating user sessions, creating roles, and so on. Actually, creating a protected web site based on ASP.NET 2.0 is very simple: create users and employ the ASP.NET web controls such as Login, and you are more or less done.

Some of these access-management features can also be implemented from JavaScript, thanks to the ASP.NET AJAX authentication service. The list of these supported features is rather short, but nevertheless, very convenient. ASP.NET AJAX supports ASP.NET 2.0 forms authentication. As a result, JavaScript code can validate user credentials. However, actual content protection must be done on the server. Always remember that JavaScript can be deactivated, which renders it insufficient to secure sensitive data.

Preparing the Application

In order to use the ASP.NET AJAX authentication service, you need users within your application. The ASP.NET Web Application Administration Tool that comes with Visual Studio and Visual Web Developer provides a very easy way to create users. First, run the tool using the ASP.NET Configuration command in the Web Site menu (see Figure 8-1).

The ASP.NET Configuration Tool (looks better in Internet Explorer, though)
Figure 8-1. The ASP.NET Configuration Tool (looks better in ...

Get Programming ASP.NET AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.