Bookmark this on Hatena Bookmark
Hatena Bookmark - ASP.NET – Disable saving of password / user name.
Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Livedoor Clip
Share on reddit


Trying to stop people saving their login details on public computers? Often it is done inadvertently by people forgetting to un-tick a “Remember me” or “Keep me logged in”. Although this is only available on sites that give the option. Even if a site doesn’t offer this function, almost all modern browsers will offer to save the password anyway.

To stop this you can simply add the following line to you page load event;

form1.Attributes.Add(“autocomplete”, “off”);

If you are using a master page you can add this to the master page code behind. Remember though if you do it this way then it will stop any text on all your pages to not remember anything when the user come back to the page. This can actually become annoying so only use it when necessary.

Another method is to change the property of the textbox, of the username and password controls, “AutoCompleteType” to “Disable“.

You may need to change both the password textbox and the username textbox properties to “Disabled” in order for this to work as most browsers use the selection of a past username as the trigger point to save/retrieve the password.

The benefit of the second method is that it only affects the targeted fields.

I have not tested this on all browsers. It has worked on IE7, IE8, Safari, Firefox and Chrome.


Related Posts:

  • No Related Posts