OpenAuth.Net/OpenAuth.Mvc/Global.asax.cs

65 lines
2.1 KiB
C#
Raw Permalink Normal View History

2017-12-08 05:49:00 +08:00
using System.Web;
2015-09-23 00:10:11 +08:00
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
2015-10-26 21:58:12 +08:00
using Infrastructure;
using Newtonsoft.Json.Linq;
2017-12-08 05:49:00 +08:00
using OpenAuth.App;
using OpenAuth.Mvc.Models;
2015-09-23 00:10:11 +08:00
namespace OpenAuth.Mvc
{
2015-11-13 23:25:46 +08:00
public class MvcApplication : HttpApplication
2015-09-23 00:10:11 +08:00
{
protected void Application_Start()
{
2015-10-26 21:58:12 +08:00
AutofacExt.InitAutofac();
2015-09-23 00:10:11 +08:00
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
ModelBinders.Binders.Add(typeof(JObject), new JobjectModelBinder());
2015-10-26 21:58:12 +08:00
LogHelper.Log("启动Web");
2015-09-23 00:10:11 +08:00
}
//protected void Application_Error(object sender, EventArgs e)
//{
// var app = (MvcApplication)sender;
// var context = app.Context;
// var ex = app.Server.GetLastError();
// LogHelper.Fatal(ex.Message);
2016-07-08 18:51:48 +08:00
// context.Response.Clear();
// context.ClearError();
// var httpException = ex as HttpException;
// var routeData = new RouteData();
// routeData.Values["controller"] = "error";
// routeData.Values["exception"] = ex;
// routeData.Values["action"] = "http500";
// if (httpException != null)
// {
2016-07-08 18:51:48 +08:00
// switch (httpException.GetHttpCode())
// {
// case 404:
// routeData.Values["action"] = "http404";
// break;
// case 401: //没有登录
// routeData.Values["action"] = "http401";
// break;
// case 400: //演示版本,没有执行的权限
// routeData.Values["action"] = "DemoError";
// break;
// }
// }
// IController controller = new ErrorController();
// controller.Execute(new RequestContext(new HttpContextWrapper(context), routeData));
//}
2015-09-23 00:10:11 +08:00
}
}