How reliable is the MaxLength property of the TextBox-Control?

荒凉一梦 提交于 2019-11-30 21:34:10

It does not depend on javascript but that does not make it safe.

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.

Can I rely on the fact, that the Text property contains no text longer than MaxLength ?

No. Consider it a user-friendliness feature. You will have(as always) re-check on the server. And maybe also check in JavaScript, depending on what its for.

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