How to Validate Forms with ASP.NET MVC 2 Data Annotations: Listing 6.

Registering the Custom Attribute in Global.asax

Sub Application_Start()
        AreaRegistration.RegisterAllAreas()
        RegisterRoutes(RouteTable.Routes)
        DataAnnotationsModelValidatorProvider.RegisterAdapter(
            GetType(WithinDaysAttribute), GetType(WithinDaysValidator))
    End Sub