charitha amarasinghe charitha amarasinghe - 1 year ago 192
ASP.NET (C#) Question

How do I prevent auto complete "Use password for:" option in chrome?

This is the example:

<asp:TextBox ID="TextBoxPassword" runat="server" TextMode="Password" autocomplete="off"></asp:TextBox>

I want to prevent the password autocomplete in my system. It seems it is not working with
. I could prevent it using
$('#<%= TextBoxPassword.ClientID %>').val("");
when the window is loading, but in Chrome there is a another option call
Use password for:
and someone can get the password by using that. So how do I prevent it?

I don't mean the "yellow background" thing that belongs to chrome.

Answer Source

In IE you need to do like this:

<asp:TextBox ID="TextBoxPassword" runat="server" AutoCompleteType="Disabled"></asp:TextBox>

In all other browsers, this:

<asp:TextBox ID="TextBoxPassword" runat="server" autocomplete="Off"></asp:TextBox>

Im pretty sure you need the 'off' to be: 'Off'

In HTML, as you mention you can use the;

<form action="demo_form.asp" autocomplete="on">
  First name:<input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  E-mail: <input type="email" name="email" autocomplete="off"><br>
  <input type="submit">

Either on the form or the input itself.

Maybe something else in your code is enabling it again?

Hope this works. Just tested and had no problem. Both IE and Chrome.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download