|
在WinForm中通过HTTP协议向服务器端上传文件(16) Request.UserAgent = this.cUserAgent; Request.Timeout = this.nConnectTimeout * 1000; // *** Save for external Access this.oWebRequest = Request; // *** Handle Security for the request if (this.cUsername.Length > 0) { if (this.cUsername=="AUTOLOGIN") Request.Credentials = CredentialCache.DefaultCredentials; else Request.Credentials = new NetworkCredential(this.cUsername,this.cPassWord); } // *** Handle Proxy Server configuration if (this.cProxyAddress.Length > 0) { if (this.cProxyAddress == "DEFAULTPROXY") { Request.Proxy = new WebProxy(); Request.Proxy = WebProxy.GetDefaultProxy(); } else { WebProxy loProxy = new WebProxy(this.cProxyAddress,true); if (this.cProxyBypass.Length > 0) { loProxy.BypassList = this.cProxyBypass.Split(';'); } if (this.cProxyUsername.Length > 0) loProxy.Credentials = new NetworkCredential(this.cProxyUsername,this.cProxyPassWord); Request.Proxy = loProxy;
|