PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Code/Source/Teaching.Threading.Web/Global.asax.cs

https://bitbucket.org/BernhardGlueck/teaching
C# | 48 lines | 39 code | 7 blank | 2 comment | 0 complexity | beb6df072e04e3d4ebf8d3050f78da79 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Http;
  7. using System.Web.Mvc;
  8. using System.Web.Optimization;
  9. using System.Web.Routing;
  10. namespace Teaching.Threading.Web
  11. {
  12. // Note: For instructions on enabling IIS6 or IIS7 classic mode,
  13. // visit http://go.microsoft.com/?LinkId=9394801
  14. public class MvcApplication : System.Web.HttpApplication
  15. {
  16. public static void RegisterGlobalFilters(GlobalFilterCollection filters)
  17. {
  18. filters.Add(new HandleErrorAttribute());
  19. }
  20. public static void RegisterRoutes(RouteCollection routes)
  21. {
  22. routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  23. routes.MapHttpRoute(
  24. name: "DefaultApi",
  25. routeTemplate: "api/{controller}/{id}",
  26. defaults: new { id = RouteParameter.Optional }
  27. );
  28. routes.MapRoute(
  29. name: "Default",
  30. url: "{controller}/{action}/{id}",
  31. defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
  32. );
  33. }
  34. protected void Application_Start()
  35. {
  36. AreaRegistration.RegisterAllAreas();
  37. RegisterGlobalFilters(GlobalFilters.Filters);
  38. RegisterRoutes(RouteTable.Routes);
  39. }
  40. }
  41. }