asp.net中验证的新方法 [英] New ways of Validations in asp.net

查看:82
本文介绍了asp.net中验证的新方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





目前我正在使用ajax工具来验证文本框,下拉菜单等。



i想知道在asp应用程序中验证服务器标签的其他方法是什么?



谢谢提前,



Krishan .....



Currently i am using ajax tools for validating textbox, dropdown's etc..

i want to know what are other ways for validating server tags in asp application?

Thanks Advance,

Krishan.....

推荐答案

理想情况下,应在客户端服务器端进行验证。



客户端,因为对于验证,你并不总是需要去服务器端和验证数据,从而延迟流程。此外,客户端验证可以帮助您随时通过响应消息提醒用户。



服务器端,因为您无法随时回复在客户端,因为用户可以选择在浏览器端禁用它。有时,黑客也会操纵数据。因此,为了确保您对所需的数据进行操作,您需要两种类型的验证。
Validations should ideally be done both at Client side and Server side.

Client side, because for the validations, you don't always need to go to Server side and validate the data, which delays the process. Also Client side validations helps you to alert the user on the go with responsive messages.

Server side, because you can't always reply on Client side as user has the option to disable it on browser side. Sometimes, hackers manipulate the data too. So, to make sure that you are operating on the data intended, you need both type of validations.


使用内置的验证控件asp:RequiredField等。如果您的要求未涵盖通过内置的有一个自定义验证器,你自己提供逻辑(客户端和服务器端)。



如果你想使用非标准客户端框架来验证您的控件然后您给自己双倍的工作,因为您需要使用不同的框架单独进行服务器验证。如果您使用内置框架,那么您将获得客户端和服务器验证。服务器验证是强制性的,客户端验证只是很好,任何人都可以禁用它。
Use the built-in validation controls asp:RequiredField etc. If you have requirements not covered by the built-in ones there is a custom validator where you supply the logic yourself (both client side and server side).

If you want to use a non-standard client framework to validate your controls then you are giving yourself double work as you need to do the server validation separately using a different framework. If you use the built-in framework then you get both client and server validation. Server validation is mandatory, client-side validation is just a "nice to have", anyone can disable it.


请参考以下文章。



了解ASP.NET验证技术 [ ^ ]



ASP.NET MVC服务器端验证 [ ^ ]



.NET Framework中数据注释的基本介绍 [ ^ ]



使用数据注释进行基本数据验证:ASP.NET MVC 3 [ ^ ]



https://msdn.microsoft.com/en-us/library/bwd43d0x%28v=vs.140%29.aspx [ ^ ]



https://msdn.microsoft.com/en -us / library / vstudio / a0z2h4sw%28v = vs.100%29.aspx [ ^ ]
Please refer the below articles .

Understanding ASP.NET Validation Techniques[^]

ASP.NET MVC Server-Side Validation[^]

Basic Introduction to Data Annotation in .NET Framework[^]

Basic Data Validation Using Data Annotations: ASP.NET MVC 3[^]

https://msdn.microsoft.com/en-us/library/bwd43d0x%28v=vs.140%29.aspx[^]

https://msdn.microsoft.com/en-us/library/vstudio/a0z2h4sw%28v=vs.100%29.aspx[^]


这篇关于asp.net中验证的新方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆