net网站中的c#密码文本框

时间:2020-12-14 00:57:15

I'm trying to create a ASP .NET website that masks the password in a registration page as the user types. I found sites that use windows form but it doesn't work for a ASP .NET website.

我正在尝试创建一个ASP。net网站,它将注册页面中的密码作为用户类型进行屏蔽。我找到了使用windows窗体的网站,但它并不适用于。net网站。

So if the user types in a password its masked like this

如果用户输入密码,它的掩体是这样的

 *******

Any website or suggestion on how I can get it to work would be great.

任何关于我如何让它工作的网站或建议都会很棒。

6 个解决方案

#1


79  

To do it the ASP.NET way:

用ASP。净道:

<asp:TextBox ID="txtBox1" TextMode="Password" runat="server" />

#2


17  

//in aspx page

/ /在aspx页面

<asp:TextBox ID="password" runat="server" TextMode="Password" />

//in MVC cshtml

/ /在MVC cshtml

@Html.Password("password", "", new { id = "password", Textmode = "Password" })

#3


4  

Use the password input type.

使用密码输入类型。

<input type="password" name="password" />

Here is a simple demo http://jsfiddle.net/cPaEN/

下面是一个简单的演示http://jsfiddle.net/cPaEN/

#4


2  

I think this is what you are looking for

我想这就是你要找的

 <asp:TextBox ID="txbPass" runat="server" TextMode="Password"></asp:TextBox>

#5


2  

@JohnHartsock: You can also write type="password". It's acceptable in aspx.

@JohnHartsock:你也可以写type="password"。它在aspx是可以接受的。

<asp:TextBox ID="txtBox" type="password" runat="server"/>

#6


1  

Simply select texbox property 'TextMode' and select password...

简单地选择texbox属性'TextMode'和选择密码…

<asp:TextBox ID="TextBox1" TextMode="Password" runat="server" />

#1


79  

To do it the ASP.NET way:

用ASP。净道:

<asp:TextBox ID="txtBox1" TextMode="Password" runat="server" />

#2


17  

//in aspx page

/ /在aspx页面

<asp:TextBox ID="password" runat="server" TextMode="Password" />

//in MVC cshtml

/ /在MVC cshtml

@Html.Password("password", "", new { id = "password", Textmode = "Password" })

#3


4  

Use the password input type.

使用密码输入类型。

<input type="password" name="password" />

Here is a simple demo http://jsfiddle.net/cPaEN/

下面是一个简单的演示http://jsfiddle.net/cPaEN/

#4


2  

I think this is what you are looking for

我想这就是你要找的

 <asp:TextBox ID="txbPass" runat="server" TextMode="Password"></asp:TextBox>

#5


2  

@JohnHartsock: You can also write type="password". It's acceptable in aspx.

@JohnHartsock:你也可以写type="password"。它在aspx是可以接受的。

<asp:TextBox ID="txtBox" type="password" runat="server"/>

#6


1  

Simply select texbox property 'TextMode' and select password...

简单地选择texbox属性'TextMode'和选择密码…

<asp:TextBox ID="TextBox1" TextMode="Password" runat="server" />