Global.asax.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Web.Mvc;
  2. using System.Web.Routing;
  3. namespace Benchmarks.Mono.AspNet
  4. {
  5. public class MvcApplication : System.Web.HttpApplication
  6. {
  7. protected void Application_Start()
  8. {
  9. ViewEngines.Engines.Clear();
  10. ViewEngines.Engines.Add(new RazorViewEngine { ViewLocationFormats = new[] { "~/Views/{0}.cshtml" } });
  11. Routes();
  12. }
  13. private void Routes()
  14. {
  15. RouteTable.Routes.MapRoute(
  16. name: "JSON",
  17. url: "json",
  18. defaults: new { controller = "Json", action = "Index" }
  19. );
  20. RouteTable.Routes.MapRoute(
  21. name: "WithProviders",
  22. url: "{controller}/{providerName}/{action}",
  23. defaults: new { action = "Index" }
  24. );
  25. RouteTable.Routes.MapRoute(
  26. name: "Default",
  27. url: "{controller}/{action}",
  28. defaults: new { action = "Index" }
  29. );
  30. }
  31. }
  32. }