Setting Up the Login User Interface
VWD ships with //带有several Login controls that encapsulate //内嵌authentication and identification security functionality//验证和身份安全功能. In this lesson you will set up //建立,设置Web pages with several of these Login controls.
First, in order to authenticate//证明(为真),鉴定 a user you need a login form. For this you will use the new Login control, which conveniently //方便地creates a configurable//结构的 login interface by merely//仅仅,只不过 draging//拖 it from the Toolbox //工具箱onto the design surface.
It's always a good idea to provide feedback//反馈 to the user about their authentication status//状态. The new LoginStatus control provides this. A nice feature of this control is that it provides a link for logging in or out, depending upon //依赖whether the user is anonymous //匿名的or authenticated//验证的,证明为真的.
Finally, you probably have often needed to display information and controls to users who are not logged in that is different from information and controls for users who are logged in. The new LoginView control makes implementing //实现this functionality much easier. As its name implies暗示,意味, a different "view" //可见,视图of the page content is displayed to the user depending upon//依赖whether they are anonymous or authenticated. In a way, the LoginView control is like a security-aware Panel control//控制面板.
You begin by creating a secure//安全 area for your site.
1. In the Solution Explorer, right-click the project and select New Folder. New this new folder "Admin".

You will not secure//使安全 this folder until the next lesson//下一节课.
2. Right-click the Admin folder and select Add New Item. Add a new Web Form called "default.aspx". You do not need a separate code file or a master page, so uncheck both options, and then click Add. Type some text to the page, such as "This is my secure Web page".
3. To the web.sitemap file add another child siteMapNode to display a link//显示一个链接 to "Administration" url="~\Admin\default.aspx".
4. Add a new Web Form to the root of your project, naming it "login.aspx". Check Place code in separate file, but leave Select master page unchecked//不选.
5. Click Design. From the Login section //部分,块of the Toolbox, drag a Login control onto the design surface.
6. In the Login Tasks menu click Auto Format and select a color scheme of your choice. Press F4 to access the Login control's properties, changing the ID to "adminLogin". Also change the DestinationPageUrl property to "~/authors.aspx" so that when the user logs in //登入they are taken directly to//转到 this page. (If this property is not set you are redirected to //转向default.aspx.)

7. Open the Master Page in Design view. Create a line break after the "Authors" header. From the Toolbox, drag a LoginView control to the design surface, placing it beneath //在下方,在...下方the "Authors" header.

8. In the LoginView Tasks menu, for Views ensure //确定that AnonymousTemplate is selected. Press ESC to close the menu and then enter some text into the white area//白色区域 below "LoginView1", such as "You are not logged in".

9. Open the LoginView Tasks menu and for Views select LoggedInTemplate. As before, enter text such as "You are currently logged in". Then, as with//与什么一样 the Login control, change its ID property to "adminLoginView".
10. From the Toolbox drag //拖a LoginStatus control ontop the design surface, placing it next to the LoginView control. Change its ID property to "adminLoginStatus". Place your cursor//鼠标 after the LoginStatus control and press Enter to create some white space for better presentation//描述,介绍.
There is nothing additional you need to configure for the LoginStatus control. It's built-in//内建Login link points to//指向 login.aspx by default. With your security interface built, you are now ready to //准备好configure the Web site's security via //经由the Web Administration Tool.
浙公网安备 33010602011771号