MVC中的服务器端验证

MVC中的服务器端验证

问题描述:

服务器端和客户端验证之间的区别是什么?如何在MVC中实现服务器端验证?

What is the differrence between server side and client side validation?How to achieve server side validation in MVC?

在Web服务器上执行服务器端代码在对任何aspx 页的请求的响应中,其中在客户端浏览器上执行了客户端代码(例如,控件的验证,动态隐藏和显示某些控件或其中的值等)
要在ASP.Net MVC中实现验证,请查看以下文章:
http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx [使用Validator Toolkit for ASP创建客户端和服务器端表单验证.NET MVC [ ^ ]
http://nickstips.wordpress.com/2011/08/18/asp-net-mvc-displaying-client-and-server-side-validation-using-qtip-tooltips/ [
Server side code get executed on the web server in the response of request for any aspx page where as client-side code get executed on the client browser (e.g validation of controls, dynamically hidding and displaying some of controls or there values etc)
For implementing validation in ASP.Net MVC, have a look at below article:
http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx[^]
Creating Client and Server-Side Form Validation using the Validator Toolkit for ASP.NET MVC[^]
http://nickstips.wordpress.com/2011/08/18/asp-net-mvc-displaying-client-and-server-side-validation-using-qtip-tooltips/[^]