tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 107

Professional in C# and Visual Basic Part 107. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 21 Security IsInRole This method takes a single parameter a string representation of the system role. It returns a Boolean value that indicates whether the user is in the role specified. Working with The property enables you to work with some specific contextual information about the authorized user. Using the property within your applications enables you to make resourceaccess decisions based on the information the object provides. With you can gain access to the user s name his authentication type and whether he is authenticated. The following table details the properties provided through . Attribute Description Authentication Type Provides the authentication type of the current user. Example values include Basic NTLM Forms and Passport. IsAuthenticated Returns a Boolean value specifying whether the user has been authenticated. Name Provides the username of the user as well as the domain of the user only if he logged on with a Windows account . For some examples of working with the User object take a look at checking the user s login name. To do this you use code similar to that shown in Listing 21-12. Listing 21-12 Getting the username of the logged-in user VB Dim UserName As String UserName C string userName userName Another task you can accomplish with the object is checking whether the user has been authenticated through your application s authentication methods as illustrated in Listing 21-13. Listing 21-13 Checking whether the user is authenticated VB Dim AuthUser As Boolean AuthUser C bool authUser authUser This example provides you with a Boolean value indicating whether the user has been authenticated. You can also use the IsAuthenticated method in an If Then statement as shown in Listing 21-14. 1018 Chapter 21 Security Listing 21-14 Using an If Then statement that checks .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.