Aap Ji

Aap Ji

  • 1.8k
  • 19
  • 875

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);
https://www.rajalacamera.fi/tuotteet/objektiivit
https://www.rajalacamera.fi/alt_api/category/?category_id=29&p=2&product_list_order=position&product_list_dir=asc&_=1559040099084

Answers (7)