工作中的项目要用到别家的网络短信平台,工作中遇到中文编码的问题,特总结以备忘。
GET方法:
public string DoWebRequest(string url) { HttpWebResponse webResponse = null; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Method = "POST"; string responseStr = null; webRequest.Timeout = 50000; webRequest.ContentType = "text/html; charset=gb2312"; try