How reliable is the MaxLength property of the TextBox-Control?(TextBox-Control 的 MaxLength 属性有多可靠?)
问题描述
TextBox 控件提供 MaxLength 属性,允许在该 TextBox 中插入的文本被客户端限制为指定数量的字符.
The TextBox control offers a MaxLength property, which allows the insertable text into that TextBox be clientside limited to the specified amount of chars.
我的问题:
- 此属性是否仅在客户端和因此依赖于浏览器?
- 我可以相信这样一个事实,即Text 属性包含的文本不超过MaxLength 已设置(仅适用于MSDN 中命名的 DisplayModes文章)还是我必须手动执行 TextBox.Text.SubString(0,所需最大长度)?
- 这一切是怎么回事使用禁用的 java 脚本?
推荐答案
它不依赖于javascript,但这并不安全.
It does not depend on javascript but that does not make it safe.
任何人仍然可以使用 javascript(例如 XmlHttpRequest)发布请求,或者只是制作一个请求以发送比最大长度规范更多的数据.这是阻止普通用户过度填充字段的好方法,但无论如何您都需要在服务器上仔细检查.
Anyone can still post a request using javascript (XmlHttpRequest for example) or just craft a request to send more data than the max-length specification. It's a good way to stop a normal user from over populating a field but it is something you need to double check on the server anyway.
这篇关于TextBox-Control 的 MaxLength 属性有多可靠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:TextBox-Control 的 MaxLength 属性有多可靠?


- 在 LINQ to SQL 中使用 contains() 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 使用 rss + c# 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01