Skip to content

Instantly share code, notes, and snippets.

@weeksdev
Created September 26, 2016 19:12
Show Gist options
  • Save weeksdev/cc759f31f5a4ce8bf7c3a5340ede9081 to your computer and use it in GitHub Desktop.
Save weeksdev/cc759f31f5a4ce8bf7c3a5340ede9081 to your computer and use it in GitHub Desktop.
Global Web Api Config
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Security;
using System.Web.SessionState;
namespace TestyMesty
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
var formatters = GlobalConfiguration.Configuration.Formatters;
var jsonFormatter = formatters.JsonFormatter;
var settings = jsonFormatter.SerializerSettings;
settings.Formatting = Newtonsoft.Json.Formatting.Indented;
settings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
GlobalConfiguration.Configure(x => x.MapHttpAttributeRoutes());
//AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment