You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB
C#

using DSRecCallback.Models;
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace DSRecCallback
{
public class MvcApplication : System.Web.HttpApplication
{
private ILog log = LogManager.GetLogger("MvcApplication");
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception lastError = Server.GetLastError();
log.Error(lastError.Message);
log.Error(lastError.StackTrace);
//Server.Transfer("~/Error/FriendError.aspx");
var resp = new RespCommon();
resp.Code = RespCommon.RespCodeUnknowErr;
resp.Msg = lastError.Message;
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.Write(JsonConvert.SerializeObject(resp));
Response.End();
}
}
}