Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to disable password autocomplete option in asp.net with c# while using MSEdge browser. I have set Autocompletetype as disabled and autocomplete attribute as off. But still auto complete option coming up.

What I have tried:

Code set as below
<asp:TextBox runat="server" ID="txtPassword" TextMode="Password" name="textfield2"
                                           onkeypress="return RestrictSpace()" oncopy="return false" onpaste="return false"
                                           oncut="return false" CssClass="NeST_LOGIN_TEXT"
                                           AutoCompleteType="Disabled" autocomplete="off"/>
Posted
Updated 3-Dec-21 0:11am

1 solution

You can't. All modern browsers provide integrated password managers, and ignore any attempt to disable autocomplete on login fields.

You appear to be deliberately trying to reduce the security of your application. Preventing autocomplete and pasting passwords will force your users to choose short and easy-to-remember passwords, which will be easy to crack - assuming you're actually storing them properly[^] in the first place.

Unless you're writing a user management page, where an admin will be setting passwords for other users, don't try to disable paste or auto-complete.

How to turn off form autocompletion - Web security | MDN[^]
 
Share this answer
 

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