Validation in a MS MVC application, revisited (mattias-jakobsson.net)
submitted by
Jakobsson(485) 2 years, 8 months ago
A while ago I posted a approach to validating you´r model and one to add captcha validation in a MS MVC application. You can find those posts here: Mvc, validate controller action input and Asp.net mvc captcha validation made easy. They both use a attribute approach to declare what to validate and how. I then find the attributes in a base controller and validate, then I put any error in the modelstate of the controller. Later, after thinking a little bit about this, I figured that I might just as well use action filters. Then I will not have to inherit from my BaseController everywhere I want to use this approach. So I sat down and rebuild it.
|category: MVC
|Views: 9
tags:
MVC another
Everyones tags:
Your Tags: