/// <summary> /// 向服务器提交XML数据 /// </summary> /// <param name="url">远程访问的地址</param> /// <param name="data">参数</param> /// <param name="method">Http页面请求方法</param> /// <returns>远程页面调用结果</returns> public static string PostDataToServer(string url, string data, string method) { HttpWebRequest request = null; try { request = WebRequest.Create(url) as HttpWebRequest; //request.UserAgent = "Mozilla/6.0 (MSIE 6.0; Windows NT 5.1; Natas.Robot)"; //request.Timeout = 3000; switch (method) { case "GET": request.Method = "GET"; break; case "POST": { request.Method = "POST"; byte[] bdata = Encoding.UTF8.GetBytes(data); request.ContentType = "application/xml;charset=utf-8"; request.ContentLength = bdata.Length; Stream streamOut = request.GetRequestStream(); streamOut.Write(bdata, 0, bdata.Length); streamOut.Close(); } break; } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamIn = response.GetResponseStream(); StreamReader reader = new StreamReader(streamIn); string result = reader.ReadToEnd(); reader.Close(); streamIn.Close(); response.Close(); return(result); } catch (Exception ex) { LoggerCore.Error(ex.Message, ex); return(string.Empty); } finally { } }
AsyncLogger(LoggerCore core) { this.core = core; }
/// <inheritdoc /> public virtual void Flush() { CheckFreed(); LoggerCore.Flush(); }
/// <summary> /// Constructor /// </summary> protected AsyncLogger() { core = new LoggerCore(new Context(this, this, LogCore)); }