热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

没有用户名的ASP.NET登录控件-ASP.NETLogincontrolwithoutaUsername

IsitpossibletousethestandardASP.NETlogincontrol,butjustasktheuserforapassword?Iam

Is it possible to use the standard ASP.NET login control, but just ask the user for a password? I am using a template, but the runtime complains that;

是否可以使用标准的ASP.NET登录控件,但只是要求用户输入密码?我正在使用模板,但运行时抱怨说;

Login1: LayoutTemplate does not contain an IEditableTextControl with ID UserName for the username.

My current thinking, is to add the control with which seems lame. The existing project already uses FormsAuthentication, so plan B might be to roll my own Authentication method.

我目前的想法是用style =“display:none;”添加控件。这似乎很蹩脚。现有项目已经使用FormsAuthentication,因此计划B可能是我自己的身份验证方法。

Update
I have a 2 step login process. Step 1: "Who are you?" and Step 2: "What is your password?"

更新我有两步登录过程。第1步:“你是谁?”和第2步:“你的密码是什么?”

4 个解决方案

#1


I'd sure style it with display:none long before rolling my own.

我肯定会用显示器来设置它的样式:在我自己开始之前没有。

#2


What functionality do you want from the Login Control? I assume your rolling your own authentication mechanism? Are you really going to gain a lot by reusing the login control? If so set the style to display:none.

您想从登录控制中获得什么功能?我假设您推出自己的身份验证机制?你真的会通过重用登录控件获得很多收益吗?如果是这样,则将样式设置为display:none。

Edit

If you identify the user on a previous page why not show a disabled textbox with the username or part of the username in it? I've seen some banks do this where on the first page you put the login and maybee the state you live in, then it validates that, then shows you the first three characters of the login name, and your site key and asks for your password.

如果您在上一页上标识用户,为什么不显示带有用户名或部分用户名的已禁用文本框?我已经看到一些银行这样做,你在登录的第一页,也许你所居住的州,然后它验证,然后显示登录名的前三个字符,和你的网站密钥,并要求你密码。

#3


Updated Answer:

Your best bet is to transform the login control into a label, and then display that over the empty textbox for their password.

您最好的办法是将登录控件转换为标签,然后在空文本框中显示其密码。

Ye Olde Answer:

Ye Olde答案:

Why do you want to do that; what happens if two users have the same password?

你为什么要这样做;如果两个用户拥有相同的密码会怎样?

#4


I haven't tested this, and it may sound a little silly, but you might be able to write a wrapper for the login control, like a UserControl with a LoginForm as a property - Then use the Init event to assign values from the controls you create to update the values onto the LoginForm (property)

我没有测试过这个,听起来有点傻,但是你可以为登录控件编写一个包装器,比如一个带有LoginForm作为属性的UserControl - 然后使用Init事件从控件中分配值您创建以将值更新到LoginForm(属性)

If the property doesn't work, you might be able to put it on the page, but make it hidden.

如果该属性不起作用,您可以将其放在页面上,但将其隐藏起来。


推荐阅读
author-avatar
直属17262676
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有