/// <summary>
/// URL参数 GB2312或者UTF-8
/// </summary>
/// <param name="Url"></param>
/// <param name="GetEncoding"></param>
/// <returns></returns>
public static string GetHttpData2(string Url, string GetEncoding)
{
string sException = null;
string sRslt = null;
WebResponse oWebRps = null;
WebRequest oWebRqst = WebRequest.Create(Url);
oWebRqst.Timeout = 90000;
try
{
oWebRps = oWebRqst.GetResponse();
}
catch (WebException e)
{
sException = e.Message.ToString();
}
catch (Exception e)
{
sException = e.ToString();
}
finally
{
if (oWebRps != null)
{
StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), Encoding.GetEncoding(GetEncoding));
sRslt = oStreamRd.ReadToEnd();
oStreamRd.Close();
oWebRps.Close();
}
}
return sRslt;
}
.net Get 请求 UTF-8 GB2312
最新推荐文章于 2021-11-22 08:53:40 发布