本文介绍了一些网址的空HttpWebResponse长度(带有查询?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 对于某些网址 (例如 http://v3.espacenet.com/origdoc?DB=E...=WO2005028634) , 的内容长度为HttpWebResponse我得到了请求.GetResponse在 为空。 response.GetResponseStream()也是空的。但是,我能够在浏览器中打开URL(URL地址保持不变;它不是 重定向) 下面是代码片段: HttpWebRequest req =(HttpWebRequest)WebRequest.Create(pageAddress); HttpWebResponse resp =(HttpWebResponse)req。 GetResponse(); StreamReader sr = new StreamReader(resp.GetResponseStream()); string pageData = sr.ReadToEnd(); 回复的内容类型是text / html;字符集= ISO-8859-1"并且 HttpStatusCode没问题。 pageData长度为0. 是否应修改URL以使其工作(例如某些替换)? 我缺少什么? 谢谢 杰森For some URLs(e.g.http://v3.espacenet.com/origdoc?DB=E...=WO2005028634),the content length for the HttpWebResponse I get with request.GetResponse inempty. The response.GetResponseStream() also empty. However, I am able toopen the URL in the browser (the URL address remains the same; it is notredirected)Here is the code snippet:HttpWebRequest req = (HttpWebRequest)WebRequest.Create(pageAddress);HttpWebResponse resp = (HttpWebResponse)req.GetResponse();StreamReader sr = new StreamReader(resp.GetResponseStream());string pageData = sr.ReadToEnd();The Content Type for the response is "text/html; charset=iso-8859-1" and theHttpStatusCode was OK. The pageData length is 0.Should the URL be modified for it to work (e.g. some substitution)?What am I missing?ThanksJason推荐答案 这篇关于一些网址的空HttpWebResponse长度(带有查询?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-23 15:04