Asp.NET MVC 3 ModelBinding验证 [英] Asp.NET MVC 3 ModelBinding Validation
本文介绍了Asp.NET MVC 3 ModelBinding验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法来禁用的自动验证
模型被传递到控制器...?
Is there a way to disable the automatic validation of a Model gets passed to a Controller... ?
推荐答案
的 ModelValidatorProviderCollection
允许您控制您的应用程序将使用什么样的验证提供者。默认情况下,我相信它使用 DataAnnotationsModelValidatorProvider
。
您可以尝试在应用程序启动清理出集 - 我从来没有尝试过,但我想这将禁用验证你
You could try clearing out the collection at application startup -- I've never tried it, but I would imagine that would disable validation for you.
protected void Application_Start()
{
// Other startup code...
ModelValidatorProviders.Providers.Clear();
}
这篇关于Asp.NET MVC 3 ModelBinding验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文