How to prevent autofill of previous data in ASP:Textbox?

99封情书 提交于 2019-12-11 07:29:55

问题


I have 2 simple controls. When my page loads, it automatic fills up.

I got following reference which suggests to set Autocomplete = Off

Stop browser from filling textboxes with details

https://forums.asp.net/t/1107643.aspx?How+do+you+disable+history+info+on+a+textbox+

But it doesn't work. You can see above screenshot. It is email field which automatically filled by reference of cache when page loaded. It is going to be headache.

Can anybody please suggest me how to prevent this?

Please note, I don't want to clear history. I just want that this should not be filled up when my page loads.


回答1:


Adding autocomplete="new-password" will solve your problem. I have tried autocomplete="off" and autocomplete="false" both did not work for me. This works perfectly autocomplete="new-password"




回答2:


I am not sure, but this could be done by the browser. In IE11, there is this setting:

Maybe it helps to delete the AutoComplete history and disable AutoComplete.

Happy DNNing! Michael




回答3:


You cannot disable the autofill programatically. It is browser behaviour, and it differs per browser. You can disable it per browser, but that is up to the client.

According to this answer, you can add hidden dummy textboxes before the actual ones to throw off the autocomplete.

<input style="display:none" type="text" name="fakeusername"/>
<input style="display:none" type="password" name="fakepassword"/>


来源:https://stackoverflow.com/questions/41636724/how-to-prevent-autofill-of-previous-data-in-asptextbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!