我不断收到脚本“window.location.reload()”当使用httpwebrequest时
<!--@R--><script>
var k ='c991130d';
var d = new Date();
d.setTime(d.getTime() + (3600*24*365*5*1000));
document.cookie = "p7c=" + k +";
expires=" + d.toGMTString();
setTimeout(function(){
window.location.reload(); },2000);
</script>
please wait....
当我使用我的代码获取网页时,我不断获取这些内容,但我可以使用 XMLhttp 和 VB 来获取整个页面,这是我的代码如下:
public static string GetPage(string Url)
{
HttpWebRequest WebRequest = (HttpWebRequest)HttpWebRequest.Create(Url);
WebRequest.Timeout = 5000;
WebRequest.AllowAutoRedirect = true;
WebRequest.Headers.Set("Pragma", "no-cache");
try
{
using (HttpWebResponse response = (HttpWebResponse)WebRequest.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
using (StreamReader sr = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
{ return sr.ReadToEnd(); }
}
}
}
catch (Exception ex){ return "%ERROR%" + ex.Message; }
}
<!--@R--><script>
var k ='c991130d';
var d = new Date();
d.setTime(d.getTime() + (3600*24*365*5*1000));
document.cookie = "p7c=" + k +";
expires=" + d.toGMTString();
setTimeout(function(){
window.location.reload(); },2000);
</script>
please wait....
when I use my code to get a web page I keep getting these, but I can use XMLhttp with VB to get the whole page, it's my code below:
public static string GetPage(string Url)
{
HttpWebRequest WebRequest = (HttpWebRequest)HttpWebRequest.Create(Url);
WebRequest.Timeout = 5000;
WebRequest.AllowAutoRedirect = true;
WebRequest.Headers.Set("Pragma", "no-cache");
try
{
using (HttpWebResponse response = (HttpWebResponse)WebRequest.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
using (StreamReader sr = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
{ return sr.ReadToEnd(); }
}
}
}
catch (Exception ex){ return "%ERROR%" + ex.Message; }
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论