vb.net code 39 generator software The FormsAuthentication Class in Visual Studio .NET

Creator Code128 in Visual Studio .NET The FormsAuthentication Class

The FormsAuthentication Class
Draw Code128 In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create Code 128 Code Set B image in ASP.NET applications.
www.OnBarcode.com
Make Bar Code In .NET Framework
Using Barcode encoder for ASP.NET Control to generate, create barcode image in ASP.NET applications.
www.OnBarcode.com
The helper methods exposed by the FormsAuthentication class are quite useful for quickly adding authentication to an ASP.NET application. The class supplies some static methods that you can use to manipulate authentication tickets. You typically use the RedirectFromLoginPage method to redirect an authenticated user back to the originally requested URL; likewise, you call SignOut to remove the authentication ticket for the current user. Other methods and properties are for manipulating and renewing the ticket and the associated cookie.
Draw ANSI/AIM Code 128 In C#
Using Barcode encoder for Visual Studio .NET Control to generate, create Code 128A image in Visual Studio .NET applications.
www.OnBarcode.com
Code 128B Generation In .NET Framework
Using Barcode generation for VS .NET Control to generate, create Code 128 image in VS .NET applications.
www.OnBarcode.com
C10620245.fm Page 321 Thursday, June 10, 2004 12:29 PM
Code 128B Generation In Visual Basic .NET
Using Barcode creator for .NET Control to generate, create Code 128 Code Set C image in .NET framework applications.
www.OnBarcode.com
2D Barcode Encoder In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create Matrix 2D Barcode image in ASP.NET applications.
www.OnBarcode.com
10
Code 128A Maker In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create Code 128 Code Set A image in ASP.NET applications.
www.OnBarcode.com
QR-Code Drawer In .NET
Using Barcode printer for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications.
www.OnBarcode.com
ASP.NET Security
ANSI/AIM Code 39 Encoder In VS .NET
Using Barcode drawer for ASP.NET Control to generate, create Code 39 Extended image in ASP.NET applications.
www.OnBarcode.com
Printing Barcode In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create bar code image in ASP.NET applications.
www.OnBarcode.com
Properties of the FormsAuthentication Class
Generating Bar Code In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create bar code image in ASP.NET applications.
www.OnBarcode.com
Print EAN - 14 In .NET Framework
Using Barcode drawer for ASP.NET Control to generate, create ITF-14 image in ASP.NET applications.
www.OnBarcode.com
Table 10-3 lists the properties of the FormsAuthentication class. As you can see, many of them deal with cookie naming and usage and expose the content of configuration attributes.
ECC200 Creation In .NET Framework
Using Barcode printer for Reporting Service Control to generate, create DataMatrix image in Reporting Service applications.
www.OnBarcode.com
Barcode Recognizer In Java
Using Barcode Control SDK for BIRT Control to generate, create, read, scan barcode image in Eclipse BIRT applications.
www.OnBarcode.com
Table 10-3 Properties of the FormAuthentication Class
Scanning Code128 In VS .NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Code 128 Printer In None
Using Barcode maker for Software Control to generate, create Code 128C image in Software applications.
www.OnBarcode.com
Property CookieDomain
Make Code 3 Of 9 In .NET
Using Barcode drawer for .NET framework Control to generate, create USS Code 39 image in .NET applications.
www.OnBarcode.com
QR Code 2d Barcode Printer In Java
Using Barcode creation for Android Control to generate, create QR Code ISO/IEC18004 image in Android applications.
www.OnBarcode.com
Description Returns the domain set for the authentication ticket. This property equals the value of the domain attribute in the <forms> section. Returns one of the four FormsCookieMode enumeration values (listed earlier in Table 10-2). Returns true if the current request supports cookies. If the AutoDetect mode is configured, it also checks for the browser s cookie capability and verifies that cookies haven t been disabled on the client. Returns the configured or default URL for the page to return after a request has been successfully authenticated. Matches the defaultUrl configuration attribute. Indicates whether redirects can span over different Web applications. Returns the configured cookie name used for the current application. The default name is .ASPXAUTH. Returns the configured cookie path used for the current application. The default is the root path /. Returns the configured or default URL for the login page. Matches the loginUrl configuration attribute. Gets a value indicating whether a cookie must be transmitted using only HTTPS. Gets a value indicating whether sliding expiration is enabled.
Drawing Code 128A In C#.NET
Using Barcode encoder for VS .NET Control to generate, create Code-128 image in VS .NET applications.
www.OnBarcode.com
Paint Universal Product Code Version A In Java
Using Barcode printer for Java Control to generate, create GS1 - 12 image in Java applications.
www.OnBarcode.com
CookieMode CookiesSupported
DefaultUrl
EnableCrossAppRedirects FormsCookieName FormsCookiePath LoginUrl RequireSSL SlidingExpiration
The properties are initialized with the values read from the application s configuration file when the application starts up.
Methods of the FormsAuthentication Class
Table 10-4 details the methods supported by the FormsAuthentication class.
C10620245.fm Page 322 Thursday, June 10, 2004 12:29 PM
Part III
Application Services
Table 10-4
Methods of the FormsAuthentication Class
Description Attempts to validate the supplied credentials against those contained in the configured <credentials> section. Returns a decrypted authentication ticket, given a valid encrypted authentication ticket obtained from an HTTP cookie. Produces a string containing an encrypted authentication ticket suitable for use in an HTTP cookie. Creates an authentication cookie for a given username. Returns the URL for the original request. Given a password and a string identifying the hash type, this method hashes the password for storage in the web.config. Initializes the FormsAuthentication class. Redirects an authenticated user back to the originally requested URL. Performs a redirect to the configured or default login page. Conditionally updates the sliding expiration on an authentication ticket. Creates an authentication ticket and attaches it to the cookies collection of the outgoing response. It doesn t redirect to the originally requested URL. Removes the authentication ticket.
Method Authenticate
Decrypt
Encrypt
GetAuthCookie GetRedirectUrl HashPasswordForStoringInConfigFile
Initialize RedirectFromLoginPage RedirectToLoginPage RenewTicketIfOld SetAuthCookie
SignOut
The Initialize method is called only once in the application s lifetime and initializes the properties in Table 10-3 by reading the configuration file. The method also gets the cookie values and encryption keys to be used for the application. RedirectToLoginPage is a new entry in the list of class methods and fills a hole in the programming interface of the FormsAuthentication class in ASP.NET 1.x. The method is useful when a user signs out, and you want to redirect her to the login page afterwards. When this happens, the method figures out what the login page is and calls Response.Redirect.
C10620245.fm Page 323 Thursday, June 10, 2004 12:29 PM
10
ASP.NET Security
Setting Up a Forms Authentication Layer
Let s review the steps for setting up a forms authentication layer on top of a Web application. These steps are not much different from what you do in ASP.NET 1.x. However, some of the methods in the FormsAuthentication class and some of the new security-specific server controls in ASP.NET 2.0 (more on this in a moment) make programming easier and faster. The typical web.config file of a secure application looks like the following code snippet:
<configuration> <system.web> <authentication mode="Forms"> <forms name= .ASPXAUTH loginUrl="login.aspx protection="All /> </authentication> <authorization> <deny users= /> </authorization> </system.web> </configuration>
The anonymous user is denied access in the <authorization> section, and all users are redirected to a particular login page to enter their credentials. The login page is responsible for authenticating the user and emitting a ticket. According to the code just shown, the authentication ticket is encrypted in the default way and packed into a cookie with the default name. Figure 10-1 shows a reasonable login page.
Figure 10-1 The login page of the sample application, in which the user enters credentials and clicks to log in
Copyright © OnBarcode.com . All rights reserved.