Asp.Net Validation - Clientside And/Or Serverside?

末鹿安然 提交于 2019-12-08 01:34:24

问题


The validator controls that can be used for asp.net input validation... requiredfieldvalidator regularexpressionvalidator etc

Do they perfrom validation on the client side AND server side or do I need to have seperate validation in my codebehind to validate on postback (ie to prevent POST injection)?


回答1:


They perform both.

The validation framework that has been implemented in asp.net was designed to work both client and server side.

If you have used these validators, you do not need to write additional server side code that repeats this validation.




回答2:


IIRC, they are validate on both the client and server side by default. EnableClientValidation is the property to set to disable client side validation.

You should always validate at the client and again on the server.



来源:https://stackoverflow.com/questions/3547330/asp-net-validation-clientside-and-or-serverside

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