C#用HttpWebRequest发送请求的时候的编码?
HttpWebRequesthttpRequest=null;HttpWebResponsehttpResponse=null;System.IO.StreamdataS...
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
System.IO.Stream dataStream = null;
try
{
httpRequest = (HttpWebRequest)WebRequest.Create(address);
httpRequest.Credentials = CredentialCache.DefaultCredentials;
//httpRequest.Timeout = 300000;
httpRequest.Timeout = timeOut;
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
dataStream = httpResponse.GetResponseStream();
......
}
catch{......}
用上述方法向address发送请求,请问这时Request的默认编码是什么?
请问如果我想用特定的编码发送时,应该怎么写?
比如用GB2312 展开
HttpWebResponse httpResponse = null;
System.IO.Stream dataStream = null;
try
{
httpRequest = (HttpWebRequest)WebRequest.Create(address);
httpRequest.Credentials = CredentialCache.DefaultCredentials;
//httpRequest.Timeout = 300000;
httpRequest.Timeout = timeOut;
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
dataStream = httpResponse.GetResponseStream();
......
}
catch{......}
用上述方法向address发送请求,请问这时Request的默认编码是什么?
请问如果我想用特定的编码发送时,应该怎么写?
比如用GB2312 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询