如何为ASP.NET应用程序设置自动完成=关闭全球范围内? [英] How to set autocomplete=off globally for ASP.NET application?

查看:137
本文介绍了如何为ASP.NET应用程序设置自动完成=关闭全球范围内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有成熟的应用程序,处理敏感数据,并且已发展到几百页和控制。现在是为整个应用程序的所有表格和文本框设置自动完成=掀起了要求。我不相信有一个全局的Web.config设置,将做到这一点,所以这将是最好的方法是什么?我最初的想法是使用一个PageBase类(所有页面继承)动态地找到所有表格和TextBox控件,动态添加属性自动完成=关闭。这是否似乎是合理的,或是否有更好的办法?感谢您的任何建议。

We have a mature application which handles sensitive data and has grown to several hundred pages and controls. It is now a requirement to set autocomplete=off for all the forms and textboxes in the entire application. I don't believe there is a global web.config setting that would do this, so what would be the best way? My initial thought was to use a PageBase class (which all pages inherit from) to dynamically find all Form and TextBox controls and dynamically add the attribute autocomplete="off". Does this seem reasonable or is there a better way? Thanks for any recommendations.

推荐答案

如果您所有的网页都母版页,然后尝试禁用在母版页使用Jquery输入控件自动完成。

If all your pages have master page then try to disable autocomplete for input controls using Jquery in the master page.

您可以将母版页下面code

You can place the below code in the master page

$(document).ready(function () { $("input").attr("autocomplete", "off"); }); 

这篇关于如何为ASP.NET应用程序设置自动完成=关闭全球范围内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆