I am trying to parse the HTML code of the http://odds.bestbetting.com/horse-racing/today page to have a list of races, etc. The problem is that I cannot get the HTML code of the page. Here is the C # function code:
public static string Http(string url) {
Uri myUri = new Uri(url);
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri);
myHttpWebRequest.AllowAutoRedirect = true;
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
var stream = myHttpWebResponse.GetResponseStream();
var reader = new StreamReader(stream);
var html = reader.ReadToEnd();
myHttpWebResponse.Close();
return html;
}
When I run the program calling the function, it throws an exception in
HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse ();
which the:
Unable to handle forwarding from HTTP / HTTPS to other dissimilar ones.
, , , .
- , , , - . : odds.bestbetting.com/horse-racing/2011-06-10/byCourse
odds.bestbetting.com/horse-racing/2011-06-10/byTime, , .
, - , . ?
!