-
Notifications
You must be signed in to change notification settings - Fork 37
/
Global.asax.cs
35 lines (32 loc) · 1.17 KB
/
Global.asax.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using StackExchange.Precompilation;
using Test.WebApp.Controllers;
namespace Test.WebApp
{
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalFilters.Filters.Add(new HandleErrorAttribute());
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
RouteTable.Routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
ViewEngines.Engines.Clear();
#if !DEBUG
// use precompiled engine first (supports some C# 6),
ViewEngines.Engines.Add(new PrecompiledViewEngine(typeof(HomeController).Assembly));
#endif
// fallback to RoslynRazorViewEngine (RazorViewEngine doesn't support C# 6).
ViewEngines.Engines.Add(new RoslynRazorViewEngine());
}
}
}