如何在asp.net webform中创建登录 [英] how to create a Login in asp.net webform

查看:275
本文介绍了如何在asp.net webform中创建登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何创建一个asp.net登录表单,但我也希望用户的名字位于谁登录的右上角?

how do i create a asp.net login form but i also want the user's name to be on the top right hand corner the who's logged in?

推荐答案

可以按照您想要的任何方式构建登录表单。您可以使用登录表单控件。或者,您可以将标签显示为用户名,并在其旁边添加一个文本框,用户可以在其中输入用户名。然后密码相同。你需要一个按钮来提交它。你会想要一个链接来恢复密码,以防他们忘记密码。如果你使用的话,你还需要一个指向注册页面的链接。



将名字放在角落很容易。你在那里放了一个标签,然后在你的代码中验证用户之后,设置一个Session变量然后你可以在任何你想要的地方使用那个Session变量。
A login form can be built any way you want to. There is a login form control you could use. Or, you can put a label that reads "User Name" and next to it a textbox where the user can enter their user name. Then same for password. You'll need a button to submit it. You'll want a link to recover a password in case they have forgotten it. You'll also want a link to a signup page if you are using one.

Putting the name in the corner is easy. You put a label there and then after the user is authenticated in your code, set a Session variable and then you can use that Session variable anywhere you want.


使用 build-in登录控件 [ ^ ]。



使用 登录控件 [ ^ ]登录表格。



使用 LoginView 控件 [ ^ ], LoginStatus 控制 [ ^ ]和 LoginName 控件 [ ^ ]自动在登录链接和经过身份验证的用户名称之间切换。



使用 CreateUserWizard 控制 [ ^ ]允许用户注册,并且 ChangePassword 控件 [ ^ ]让用户更改密码。
Use the built-in login controls[^].

Use the Login control[^] for the login form.

Use a combination of the LoginView control[^], the LoginStatus control[^] and the LoginName control[^] to automatically switch between a "Log in" link and the authenticated user's name.

Use the CreateUserWizard control[^] to allow users to register, and the ChangePassword control[^] to let users change their password.


这篇关于如何在asp.net webform中创建登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆