Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop the browser storing form data which user entered in text fields

Tags:

c#

asp.net

I dont know whether this simple task or not, but I tried to search in google but couldn't find anything.

I've a asp.net form and user enters some data in the text boxes provided. Whenever user submits the form, browser will save that form data. I don't want this form data to be saved in browser. How can I restrict the browser saving this form data without touching the browser settings?

Application is developed using asp.net and normal text boxes are used here.

like image 851
JPReddy Avatar asked Nov 17 '25 01:11

JPReddy


1 Answers

I'm guessing you mean you want the browser to stop remembering values entered, i.e. the browser's autocomplete?

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

Or this will work in FF and IE, but it's not XHTML standard:

<form name="form1" id="form1" autocomplete="off" />

Note that autocomplete is only defined in the HTML 5 standards, so it will break any validations you run against HTML 4.

If not, on PostBack, just clear the inputs:

TextBox.Text = string.Empty;
like image 149
djdd87 Avatar answered Nov 18 '25 13:11

djdd87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!