void PerformCorsCheck() { var ctx = System.Web.HttpContext.Current; var httpRequest = new HttpContextRequest(new HttpRequestWrapper(ctx.Request)); var accessRequest = new CorsAccessRequest(httpRequest); if (accessRequest.IsCors) { var accessResponse = UrlBasedCorsConfiguration.Configuration.Engine.CheckAccess(accessRequest); if (accessResponse != null) { var response = ctx.Response; var httpResponse = new HttpContextResponse(new HttpResponseWrapper(response)); accessResponse.WriteResponse(httpResponse); } if (accessRequest.IsCorsPreflight) { ctx.Response.StatusCode = 200; ctx.Response.End(); } } }