public string GetJson(string URL)
{
try
{
ServicePointManager.SecurityProtocol |=
SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(URL);
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(webStream);
string response = responseReader.ReadToEnd();
return response;
}
catch (WebException e)
{
log+= e.Message + "\n";
if(e.Response != null){
log+= new StreamReader(e.Response.GetResponseStream()).ReadToEnd().ToString();
}
return "-1";
}
return "-1";
}
string contactHistoryReplace = resultStr.Replace("http://www.v8.1c.ru/ssl/contactinfo", WebUtility.UrlEncode("http://www.v8.1c.ru/ssl/contactinfo"))
.Replace("http://www.w3.org/2001/XMLSchema", WebUtility.UrlEncode("http://www.w3.org/2001/XMLSchema"))
.Replace("http://www.w3.org/2001/XMLSchema-instance", WebUtility.UrlEncode("http://www.w3.org/2001/XMLSchema-instance"))
.Replace(@"\r\n", string.Empty)
.Replace(@"\", string.Empty)
.Replace("\"", "\\\"");