private byte[] ReadHttpResponse(HttpWebResponse response)
{
Stream respStream = response.GetResponseStream();
List<byte> responseBytesList = new List<byte>();
int read;
do
{
read = respStream.ReadByte();
if (read != -1)
{
byte singleByte = (byte)read;
responseBytesList.Add(singleByte);
}
}
while (read != -1);
return responseBytesList.ToArray();
}