Aap Ji

Aap Ji

  • 1.9k
  • 19
  • 1.4k

Website responding with Error message in HttpWebRequest

May 29 2019 8:51 AM
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.
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.
{ "message": "refresh" }
  1. HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URI);  
  2. request.Headers.Add("IfModifiedSince", DateTime.Now.ToString());  
  3. request.Method = "GET";  
  4. string result = string.Empty;  
  5. using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())  
  6. {  
  7. Stream dataStream = response.GetResponseStream();  
  8. StreamReader reader = new StreamReader(dataStream);  
  9. result = reader.ReadToEnd();  
  10. reader.Close();  
  11. dataStream.Close();  
  12. }  
  13. Debug.Write(result);

Brought to you by:

Answers (7)