Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Application_Start to Read Routes Config
protected void Application_Start()
// Get the routes config
var routesConfig = (RoutesConfig)ConfigurationManager.GetSection("routes");
if (routesConfig == null)
throw new ConfigurationErrorsException("Routes config section does not exist.");
// Store routes config for use by WebApiConfig.Register
GlobalConfiguration.Configuration.Properties.TryAdd("RoutesConfig", routesConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment