private static HttpWebRequest CreateWebRequest(string url, RequestMethod requestMethod) { var request = (HttpWebRequest)WebRequest.Create(url); request.Method = requestMethod.ToCode(); if (request.Proxy != null) { request.UseDefaultCredentials = true; request.Proxy = new WebProxy(); } return(request); }