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 属性有多可靠?
基础教程推荐
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 如果条件可以为空 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 将数据集转换为列表 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
