|
在WinForm中通过HTTP协议向服务器端上传文件(20) if (Response.ContentEncoding.Length > 0) enc = Encoding.GetEncoding(Response.ContentEncoding); else enc = Encoding.GetEncoding(1252); } catch { // *** Invalid encoding passed enc = Encoding.GetEncoding(1252); } // *** drag to a stream StreamReader strResponse = new StreamReader(Response.GetResponseStream(),enc); return strResponse; } catch(Exception e) { if (this.bThrowExceptions) throw e; this.cErrorMsg = e.Message; this.bError = true; return null; } } /// <summary> /// Return a the result from an HTTP Url into a StreamReader. /// Client code should call Close() on the returned object when done reading. /// </summary> /// <param name="Url">Url to retrieve.</param> /// <returns></returns> public StreamReader GetUrlStream(string Url) { HttpWebRequest oHttpWebRequest = null; return this.GetUrlStream(Url,oHttpWebRequest); } /// <summary> /// Return a the result from an HTTP Url into a StreamReader. /// Client code should call Close() on the returned object when done reading. /// </summary>
|