// Token: 0x060000EA RID: 234 RVA: 0x00004830 File Offset: 0x00002A30 public static HttpWebRequest Create(Uri uri) { if (!WebRequestHelper.HasSetSecurityProtocol) { WebRequestHelper.SetSecurityProtocol(uri); } HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri); httpWebRequest.UserAgent = string.Format("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.123; WOW64; Trident/5.0; .NET4.0E; Kingdee/{0} MANM)", typeof(WebRequestHelper).Assembly.FullName); string text = ConfigurationManager.AppSettings.Get("ProxyHost"); Uri address = null; if (text != null && Uri.TryCreate(text, UriKind.RelativeOrAbsolute, out address)) { httpWebRequest.Proxy = new WebProxy(address); } if (uri.Scheme.Equals("https", StringComparison.CurrentCultureIgnoreCase)) { string cerFile = WebRequestHelper.GetCerFile(); if (File.Exists(cerFile)) { X509Certificate value = new X509Certificate(cerFile); httpWebRequest.ClientCertificates.Add(value); } else { X509Store x509Store = new X509Store(StoreName.My); if (x509Store.Certificates.Count == 1) { httpWebRequest.ClientCertificates.Add(x509Store.Certificates[0]); } else if (x509Store.Certificates.Count > 0) { X509Certificate2Collection x509Certificate2Collection = x509Store.Certificates.Find(X509FindType.FindBySubjectName, Environment.MachineName, true); if (x509Certificate2Collection.Count > 0) { httpWebRequest.ClientCertificates.Add(x509Certificate2Collection[0]); } httpWebRequest.ClientCertificates.Add(x509Store.Certificates[0]); } } } return(httpWebRequest); }
// Token: 0x060000EB RID: 235 RVA: 0x00004974 File Offset: 0x00002B74 private static string GetCerFile() { string text; if (Environment.UserInteractive) { text = WebRequestHelper.TryToGetCerFile(AppDomain.CurrentDomain.BaseDirectory); if (!File.Exists(text)) { text = WebRequestHelper.TryToGetCerFile(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName); } } else { text = WebRequestHelper.TryToGetCerFile(AppDomain.CurrentDomain.BaseDirectory); if (!File.Exists(text)) { text = WebRequestHelper.TryToGetCerFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data")); } } return(text); }
// Token: 0x060000E9 RID: 233 RVA: 0x00004814 File Offset: 0x00002A14 public static HttpWebRequest Create(string uri) { Uri uri2 = new Uri(uri); return(WebRequestHelper.Create(uri2)); }