public static string GetHTTPInfo(string urlPath, string eCode, int millisecond)
{
string str = null;
HttpWebResponse response = null;
StreamReader reader = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlPath);
request.Timeout = millisecond;
response = (HttpWebResponse)request.GetResponse();
reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding(eCode));
str = reader.ReadToEnd();
}
catch
{
str = "";
}
finally
{
if (reader != null)
{
reader.Close();
reader.Dispose();
}
if (response != null)
{
response.Close();
}
}
return str;
}
using Newtonsoft.Json;
string jsonstr = context.Request["jsonstr"];
JArray javascript = (JArray)JsonConvert.DeserializeObject(jsonstr);
用Newtonsoft.Json;