public HttpResponseMessage Get() { try { string clientIpAddress = base.Request.GetClientIpAddress(); IPPolicy policy = IPAddressManager.Manager.CheckPolicy(clientIpAddress); IPRegion region = IPAddressManager.Manager.CheckRegion(clientIpAddress); if ((((region != IPRegion.Inside) && (region != IPRegion.All)) || (policy == IPPolicy.Forbiden)) || !clientIpAddress.StartsWith(":")) { return(new HttpResponseMessage(HttpStatusCode.Forbidden)); } } catch (Exception exception) { Logger.Error(exception); } if (HttpContext.Current.IsWebSocketRequest) { try { HttpContext.Current.AcceptWebSocketRequest(new Func <AspNetWebSocketContext, Task>(WebSocketContext.ProcessWSChat)); } catch (Exception exception2) { Logger.Error(exception2); } } return(new HttpResponseMessage(HttpStatusCode.SwitchingProtocols)); }
public HttpResponseMessage Get() { string clientIpAddress = base.Request.GetClientIpAddress(); IPPolicy policy = IPAddressManager.Manager.CheckPolicy(clientIpAddress); IPRegion region = IPAddressManager.Manager.CheckRegion(clientIpAddress); DBData data = new DBData(); data.Add("policy", policy); data.Add("region", region); data.Add("clientip", clientIpAddress); return(HttpHelper.toJson(data)); }