Introduction to landing controls in asp.net 2.0 (2)
Source: Internet
Author: User
Asp.net| Control Login Control
Drag a login control into the form, you will find the same as the usual landing window, in the control's Properties window, the more important is the Destinationpageurl property, which will specify the user to jump after landing the page, FailureText indicates the text of the prompt after the login failed, Createusertext indicates the text of the prompt that created the new user, passwordrecoverytext the text that prompts the password, Passwordrecoveryurl represents the implementation of the password hint restore function link, in addition can set many of its properties, such as display user name, password text, landing button Passwordrecoveryurl text, etc., are very simple, we can go to try, The landing box after the initial setting of the property is as follows:
LoginName and LoginStatus controls
General login module, when the user after the successful landing, will display the user's current login status, such as "Welcome XXX User Login" prompt, but also will show "LOGOUT (exit)" hint, at this time, we can through the LoginName and LoginStatus control to achieve, On the index.aspx page, add
<form runat= "Server" >
Welcome <asp:loginname id= "Lnuser" runat= "Server"/>, your login was SUCCESSFUL!<BR/><BR/>
<asp:loginstatus id= "Lsuser" runat= "Server"/>
</form>
When the user logs on, the following is displayed:
LoginView Control
Another very useful control is the LoginView. It will display different landing content depending on the user's role. For example, as an administrator after landing, want to see all departments of personnel information, and only want a department of people to see only the Department of Information, LoginView control can do this. In the example of this article, the message that you want the system to display to anonymous visitors is to want them to sign up for users, and for those who have already logged in, you will be welcome to visit them again. The anonymoustemplate template and LoggedInTemplate template for the LoginView control are used at this time. The anonymoustemplate template is used to display the prompt information to anonymous users, the LoggedInTemplate template is used to display the prompt information to the logged in user, the code is as follows:
<asp:loginview id= "Lvdorknozzle" runat= "Server"
<LoggedInTemplate>
Welcome <asp:loginname id= "Lnuser" runat= "Server"/>
</LoggedInTemplate>
<AnonymousTemplate>
Welcome to the Dorknozzle SITE!<BR/>
Please click ' on the ' New User link to register on our site.
</AnonymousTemplate>
</asp:LoginView>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service