-
Notifications
You must be signed in to change notification settings - Fork 0
/
Global.asax.cs
33 lines (27 loc) · 919 Bytes
/
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
using System.Linq;
using System.Web.Http;
namespace POCServices
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
/// <summary>
/// to handle OPTIONS requests you must reply with empty response,
/// </summary>
protected void Application_BeginRequest()
{
if (Request.Headers.AllKeys.Contains("Origin") && Request.HttpMethod == "OPTIONS")
{
Response.Flush();
}
}
protected void Application_PostAuthorizeRequest()
{
string url = System.Web.HttpContext.Current.Request.Path;
System.Web.HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
}
}
}