I have a HTMLUI control on a form and am trying to load an internal uri. When I call the LoadHTML method on the response stream nothing loads. However, if I take the same stream and put it through a StreamReader and write the output to a console, I can see the full page output-ted on the console.
What am I missing?
string oxtUri = "
http://internal.site.com";Uri uri = new Uri( oxtUri );
WebRequest request = WebRequest.Create( oxtUri );
WebResponse response = request.GetResponse();
// This does not work and does not load the page.
Stream htmlStream = response.GetResponseStream();
if( htmlStream != null)
{
htmluiControl1.LoadHTML( htmlStream );
}
// Doing this however, prints the whole page on the console.
Stream receiveStream = response.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader readStream = new StreamReader( receiveStream, encode );
Console.WriteLine("\rResponse stream received.");
Char[] read = new Char[256];
//Reads 256 characters at a time.
int count = readStream.Read( read, 0, 256 );
Console.WriteLine("HTML...\r");
while (count > 0)
{
String str = new String(read, 0, count);
Console.Write(str);
count = readStream.Read(read, 0, 256*256);
}
Console.WriteLine("");
response.Close();
readStream.Close();