Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed an website in Asp.net c#. I have two login page one is for main website login and other is for Core functionality login.
My Problem is when main lagin page password is remembered and i open core functionality login page it will automatic Set user name and password of main login page to Core functionality page. Both login page have different credential and different tables. When i remove password type from password text box it will not fill credential, but this is not right way.

Basically, i don't want to auto fill/set credential to login page if browser saved it.
XML
<asp:TextBox ID="txtInUserName" runat="server" autocomplete="off" Text="">
<asp:TextBox ID="txtInPassword" autocomplete="off" runat="server" Text="" TextMode="Password">

When i remove TextMode="Password" from Password textbox it will working fine, But it will shows password to everyone while typing.

Thanks.
Posted
Updated 24-Feb-15 19:48pm
v2

You can do it like this

XML
You can turn off this property by :

<form id="frm1" method="post" runat="server" autocomplete="off">

Or for a specific TextBox  :

<asp:TextBox ID="txt1"  Runat="server" autocomplete="off"></asp:TextBox>
 
Share this answer
 
Comments
[no name] 25-Feb-15 1:35am    
I have tried autocomplete="off" in Textbox but it will not working.
Like this :

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server" autocomplete="off">

<asp:TextBox ID="txtInUserName" runat="server" placeholder="Enter User Name"
autocomplete="off" Text="">
<asp:TextBox ID="txtInPassword" PlaceHolder="Enter Password" autocomplete="off"
runat="server" Text="" TextMode="Password">

When I remove TextMode="Password" it will works. But, it is meaningless.
TextBoxPassword.Attributes.Add("value", "");
 
Share this answer
 
Comments
Richard Deeming 20-Mar-24 5:07am    
Aside from the fact that the OP is (hopefully) not still struggling with this problem nine years later...

Setting the value to an empty string will NOT affect autocompletion.

The "real" answer is that, for many years now, browsers don't support turning autocomplete off for login fields[^].

And that's a good thing. Users should be able to use their browser's password manager to store and complete their credentials, rather than having to pick an insecure password they can remember, reuse a single password across multiple sites, or have every password written on a post-it note stuck to their monitor.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900