ASP.Net: How to turn off autocomplete on a textbox

Autocomplete is the browser functionality that can remember different types of textboxes on websites and suggest options from a list to save the user time.

Instead of having to type in a name, address or email address, autocomplete can recognise these types of textboxes and present a dropdownlist of potential options.  These options are based on what the user has typed into similar textboxes on websites.

There are cases where as a web developer you might want to turn off the autocomplete functionality for certain textboxes.  For example, it may be a security concern if a password textbox can be populated from an autocomplete list.

As an ASP.Net web developer, it is easy to turn off autocomplete.

Within Visual Studio, simply select the TextBox control in question and look at the Properties. One of the properties will be AutoCompleteType. By default AutoCompleteType is set to None.

This does not mean that autocomplete is not used. It means that a browser can select an option for this textbox from a general list.

To disable autocomplete you need to change the AutoCompleteType from None to Disabled.  When the AutoCompleteType is set to Disabled the web browser will ignore this textbox when suggesting autocomplete information.


Comments are closed