当前位置导航:炫浪网>>网络学院>>编程开发>>Visual Basic教程

ASP.NET 3.5中的Login控件应用vb.net实现

The ASP.NET login controls provide a robust login solution for ASP.NET Web applications without requiring programming. By default, login controls integrate with ASP.NET membership and forms authentication to help automate user authentication for a Web site. It provides you with a ready-to-use user interface that queries the user name and password from the user and offers a Log In button for login. It validate user credentials against the membership API and encapsulating the basic froms authentication functionality like redirecting back to the original requested page in a restricted area of you application after the successful login.

The Login control displays a user interface for user authentication. The Login control contains text boxes for the user name and password and a check box that allows users to indicate whether they want the server to store their identity using ASP.NET membership and automatically be authenticated the next time they visit the site.

The Login control has properties for customized display, for customized messages, and for links to other pages where users can change their password or recover a forgotten password. The Login control can be used as a standalone control on a main or home page, or you can use it on a dedicated login page. If you use the Login control with ASP.NET membership, you do not need to write code to perform authentication. However, if you want to create your own authentication logic, you can handle the Login control's Authenticate event and add custom authentication code.

Note - Login controls might not function correctly if the Method of the ASP.NET Web page is changed from POST (the default) to GET.

Start Microsoft Visual Studio 2008

Create a new ASP.NET WebSite using Visual Basic, Like this:



  • Drag and drop Login control on page from ToolBox.





    Figure 1.
    Whenever user hits the Log In button, the control automatically validates the user name and password using the membership API function Membership.ValidateUse() and then calls FormAuthentication.redirectFromLoginPage() if the validation was successful. All options on the UI of the LoginControl affect the input delivered by the control to these methods. For Example, if you click the "Remember me next time" check box, it passes the value true to the createPresistentCookie parameter of the RedirectFromLoginPage() method. Therefore, the FormAuthenticateModule creates a persistent cookie.
  • There are three Login Tasks by default.
  • Auto Format - you can select default schemes.
    Convert To Template - You can edit content of Login Control.
    Administer Website -  You can configure Web Site Administration Tools, Like Security, Application, Provider.

 

Figure 2.

共3页 首页 上一页 1 2 3 下一页 尾页 跳转到
相关内容
赞助商链接