Professional ASP.NET 3.5 in C# and Visual Basic Part 70

Professional in C# and Visual Basic Part 70. 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 13 Extending the Provider Model Validating Users One of the more important features of the membership provider is that it validates users it authenticates them . The validation of users is accomplished through the Login server control. This control in turn makes use of the method that ends up using the ValidateUser method in the XmlMembershipProvider class. Now that the Initialize method and private variables are in place you can start giving the provider some functionality. The implementation of the ValidateUser method is presented in Listing 13-15. Listing 13-15 Implementing the ValidateUser method VB Public Overrides Function ValidateUser ByVal username As String _ ByVal password As String As Boolean If username Or password Then Return False End If Try ReadUserFile Dim mu As Membershipuser If mu Then If password Then Return True End If End If Return False Catch ex As Exception Throw New Exception End Try End Function C public override bool ValidateUser string username string password if username password return false try ReadUserFile MembershipUser mu if out mu Continued 647 Chapter 13 Extending the Provider Model if password return true return false catch Exception ex throw new Exception Looking over the ValidateUser method you can see that it takes two parameters the username and the password of the user both of type String . The value returned from ValidateUser is a Boolean just a True or False value to inform of the success for failure of the validation process. One of the first operations performed in the ValidateUser method is a check to determine whether either the username or the password is missing from the invocation. If one of these items is missing in the request a False value is returned. .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.