You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/NzbDrone.Web/Global.asax.cs

67 lines
1.9 KiB

using System;
using System.Diagnostics;
using System.Threading;
using System.Web;
using System.Web.Mvc;
14 years ago
using System.Web.Routing;
using Ninject;
using Ninject.Web.Mvc;
using NLog;
14 years ago
using NzbDrone.Core;
namespace NzbDrone.Web
{
public class MvcApplication : NinjectHttpApplication
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
14 years ago
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*robotstxt}", new { robotstxt = @"(.*/)?robots.txt(/.*)?" });
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Series", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected override void OnApplicationStarted()
{
Instrumentation.Setup();
CentralDispatch.DedicateToHost();
14 years ago
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
base.OnApplicationStarted();
}
14 years ago
protected override IKernel CreateKernel()
{
return CentralDispatch.NinjectKernel;
}
// ReSharper disable InconsistentNaming
protected void Application_Error(object sender, EventArgs e)
{
var lastError = Server.GetLastError();
if (lastError is HttpException)
{
Logger.WarnException("", lastError);
}
else
{
Logger.FatalException("", lastError);
}
}
protected void Application_BeginRequest()
{
Thread.CurrentThread.Name = "UI";
14 years ago
}
14 years ago
}
}