且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

自定义验证是客户端控制还是服务器端?

更新时间:2023-11-27 22:04:34

ASP.NET中的所有验证控件都是客户端控件。请先把GOOGLED问到这里......
All Validation Controls in ASP.NET are Client Side Controls. Please GOOGLED before putting your question here...


当然客户端伙计但是使用自定义验证有两个好处,一个是你可以添加javascript功能nd验证控件,第二个是你可以调用服务器端方法也............
ofcourse client side dude but using custom validation have two benefits one is you can add javascript function nd validate controls and second is you can call server side method also ............


所有验证控件都必须在客户端本身进行,以减少服务器端脚本,因为它必须与服务器交互或者服务或数据库等,

但是在某些应用程序或某些人会为了安全而双方进行验证,

因为假设你使用javascript意味着某些系统可能会被禁用或jquery文件未加载意味着它可能导致错误的验证。这就是为什么有些人会在两端都这样做。
All validation controls are must be made in the client side itself to reduce the server side scripting as its has to interact with server or service or database etc.,
But in some applications or some people will do validation in both sides for safety,
because suppose if your using javascript means some systems may disabled or jquery file not get loaded means it may results to wrong validation. Thats why some people will do in both ends.