Created
March 8, 2012 05:35
-
-
Save srkirkland/1998937 to your computer and use it in GitHub Desktop.
data annotations extensions global.asax in vb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Imports DataAnnotationsExtensions.ClientValidation | |
| Public Class MvcApplication | |
| Inherits System.Web.HttpApplication | |
| Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection) | |
| filters.Add(New HandleErrorAttribute()) | |
| End Sub | |
| Shared Sub RegisterRoutes(ByVal routes As RouteCollection) | |
| routes.IgnoreRoute("{resource}.axd/{*pathInfo}") | |
| ' MapRoute takes the following parameters, in order: | |
| ' (1) Route name | |
| ' (2) URL with parameters | |
| ' (3) Parameter defaults | |
| routes.MapRoute( _ | |
| "Default", _ | |
| "{controller}/{action}/{id}", _ | |
| New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional} _ | |
| ) | |
| End Sub | |
| Sub Application_Start() | |
| AreaRegistration.RegisterAllAreas() | |
| RegisterGlobalFilters(GlobalFilters.Filters) | |
| RegisterRoutes(RouteTable.Routes) | |
| DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions() | |
| End Sub | |
| End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment