Skip to content

Instantly share code, notes, and snippets.

@srkirkland
Created March 8, 2012 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srkirkland/1998937 to your computer and use it in GitHub Desktop.
Save srkirkland/1998937 to your computer and use it in GitHub Desktop.
data annotations extensions global.asax in vb
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