I am trying to make an HttpWebRequest to a remote sensor with an HTML server on it to pull back the data.
I think the problem is that the web server has some issue with it. I can get the web page to render in a web browser and the data is visible. That's the data I want to parse and store into a relational database.
When I look at the response headers in Fiddler, I can see that it is returning a 500 Bad Response. So, what I think is going on is, the headers say Bad Response but in includes the valid web page anyway.
I don't think i can fix the web server. I would like to just grab the data and parse it. Unfortunately the Response object is null.
The error thrown is WebExceptionStatus.ServerProtocolViolation and in the catch branch, the Response is null.
What can I do in this scenario?
UPDATE:
Another issue is that there is no HTML tag. Here is the raw returned response from Fiddler:
HTTP/1.1 500 Fiddler - Bad Response
Date: Thu, 06 Aug 2015 18:13:27 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 14:13:27.775
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="refresh" content="5"/>
<meta http-equiv="cache-control" content="no-cache">
<title>IQS WebServer</title>
<style type="text/css">
body {font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 0.8em;}
table {/*font-size: 0.8em;*/ /*font-family: monospace;*/}
.CaptionRow {font-weight:bold; background: #EFF3EB;}
.OddRow {background: #EFF3EB;}
</style>
</head>
And there is a body from there.
I don't know why its throwing the 500 and why there is not an HTML tag but I don't really care about how poorly formed the response is - I really just want to get at the response and process the data contained within it regardless but the library isn't allowing it. The response is null and I am thus, stuck.