Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Sau khi bạn mở trang trong Ví dụ 26,28, nếu bạn nhấp vào liên kết Đăng nhập, bạn sẽ được chuyển hướng đến trang đăng nhập. Nếu bạn nhập tên người dùng hợp lệ và mật khẩu, bạn sẽ được chuyển trở lại trang ShowLoginStatus.aspx. Việc kiểm soát LoginStatus hỗ trợ các thuộc tính sau: | 1184 CHAPTER 26 Using the Login Controls LISTING 26.28 ShowLoginStatus.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD xhtml1-transitional.dtd html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Show LoginStatus title head body form id form1 runat server div asp LoginStatus id LoginStatus1 Runat server hr Additional information is available to registered users. Log in to view the additional information. div form body html After you open the page in Listing 26.28 if you click the Login link you are redirected to the Login page. If you enter a valid username and password you are redirected back to the ShowLoginStatus.aspx page. The LoginStatus control supports the following properties LoginImageUrl Enables you to specify an image for the Login link. LoginText Enables you to specify the text for the Login link. LogoutAction Enables you to control what happens when the Logout link is clicked. Possible values are Redirect RedirectToLoginPage and Refresh. LogoutImageUrl Enables you to specify an image for the Logout link. LogoutPageUrl Enables you to specify a page to which the user is redirected when the user logs out. This property is ignored unless the LogoutAction property is set to the value Redirect. LogoutText Enables you to specify the text for the Logout link. From the Library of Wow eBook Using the LoginName Control 1185 The LoginStatus control also supports the following two events LoggingOut Raised before the user is logged out. LoggedOut Raised after the user is logged out. Using the LoginName Control The LoginName control displays the current user s registered username. If the current user is not authenticated the LoginName control renders nothing. The page in Listing 26.29 contains both a LoginName and LoginStatus control. LISTING 26.29 ShowLoginName.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD .