C#httprequest以错误消息回复{“message”:“refresh”} [英] C# httprequest responding with error message { “message”: “refresh” }

查看:100
本文介绍了C#httprequest以错误消息回复{“message”:“refresh”}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题:



首先,当我试图从这个网站获取数据时,它在浏览器中运行良好,但是当我在C#中使用httpwebrequest发送请求时它响应此消息。在第一次尝试时它可能会返回数据,但如果发送请求再次返回此消息。



I have two problems:

First, when I am trying to get data from this website it goes well within browser but when I send request using httpwebrequest in C# it responds with this message. In first attempt it may return data but if the send request again it returns this message.

{
    "message": "refresh"
}





其次,当我转到第2页或点击下一页转到另一页时,它会生成数字(最后)每次刷新浏览器时都不一致。我怎样才能得到这些数字?例如:= 1559040099084就像这样。



链接



[ API ]





Second, when I go to page-2 or click next to go to another page it generates numbers (in end) which is not consistent changes everytime I refresh browser. How can I get these numbers? For example: "=1559040099084" like this.

Link

[API]

URI used is the web address in the APILink above.







HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URI);
            request.Headers.Add("IfModifiedSince", DateTime.Now.ToString());
            request.Method = "GET";
            string result = string.Empty;
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);
                result = reader.ReadToEnd();
                reader.Close();
                dataStream.Close();
            }
            Debug.Write(result);





我尝试过:



我搜索了类似的问题,但没有得到相关的问题。其次我在Stackoverflow上发布了这个问题,但没有得到任何回应。



What I have tried:

I have searched for similar questions but not getting related question. Secondly I have posted this question on Stackoverflow but didn't get any respond.

推荐答案

检查 HttpWebResponse 对象的属性以获取有关出错的更多信息。
Examine the HttpWebResponse object's properties to get more info on what went wrong.


这篇关于C#httprequest以错误消息回复{“message”:“refresh”}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆