How I do to force the browser to not store the HTML form field data? How I do to force the browser to not store the HTML form field data? asp.net asp.net

How I do to force the browser to not store the HTML form field data?


Try with the atribute autocomplete="off"

It should work for single input elements:

<input type="text" autocomplete="off" name="text1" />

or to the entire form:

<form name="form1" id="form1" method="post" autocomplete="off"  action="http://www.example.com/action">[...]</form>

And specifically for ASP .NET you can set it like this:

The WebForms form:

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

Textboxes:

<asp:TextBox Runat="server" ID="Textbox1" autocomplete="off"></asp:TextBox>

or at runtime:

Textbox1.Attributes.Add("autocomplete", "off");


See a longer discussion here:

How do you disable browser Autocomplete on web form field / input tag?

It looks like autocomplete="off" will work in some cases but it is not XHTML compliant.


It is good to use the autocomplete="off" for public computers when you store data like usernames, credit card numbers and such.

So if you build a intranet system it would be OK to do it.