WebResponse help

R

Randy

How do I get the contents of the HttpWebResponse to display in a web browser
(IE or browser control)? Here is a code snippet. The response ends up
being jscript with a window.open().


webRequest.Method = "POST";

buffer = new byte[urlExecute.Length - 1];

for (int i = 0 ; i < urlExecute.Length - 1 ; i++)

{

buffer =
(byte)Microsoft.VisualBasic.Strings.AscW(urlExecute.Substring(i,1));

}

webRequest.ContentLength = buffer.Length;

webRequest.KeepAlive = false;

webStream = webRequest.GetRequestStream();

webStream.Write(buffer,0,buffer.Length);

webResponse = (HttpWebResponse)webRequest.GetResponse();


Thanks for the help!
 
J

Joerg Jooss

Randy said:
How do I get the contents of the HttpWebResponse to display in a web
browser (IE or browser control)? Here is a code snippet. The
response ends up being jscript with a window.open().


webRequest.Method = "POST";

buffer = new byte[urlExecute.Length - 1];

for (int i = 0 ; i < urlExecute.Length - 1 ; i++)

{

buffer =
(byte)Microsoft.VisualBasic.Strings.AscW(urlExecute.Substring(i,1));

}

webRequest.ContentLength = buffer.Length;

webRequest.KeepAlive = false;

webStream = webRequest.GetRequestStream();

webStream.Write(buffer,0,buffer.Length);

webResponse = (HttpWebResponse)webRequest.GetResponse();


A brute force approach would be to dump the response to a local file,
and run IE using the Process class with that local file as input.

Cheers,
 
O

Ollie Riches

I believe this is what you want to do:

http://www.codeproject.com/csharp/winformiehost.asp

HTH

Ollie Riches

Joerg Jooss said:
Randy said:
How do I get the contents of the HttpWebResponse to display in a web
browser (IE or browser control)? Here is a code snippet. The
response ends up being jscript with a window.open().


webRequest.Method = "POST";

buffer = new byte[urlExecute.Length - 1];

for (int i = 0 ; i < urlExecute.Length - 1 ; i++)

{

buffer =
(byte)Microsoft.VisualBasic.Strings.AscW(urlExecute.Substring(i,1));

}

webRequest.ContentLength = buffer.Length;

webRequest.KeepAlive = false;

webStream = webRequest.GetRequestStream();

webStream.Write(buffer,0,buffer.Length);

webResponse = (HttpWebResponse)webRequest.GetResponse();


A brute force approach would be to dump the response to a local file,
and run IE using the Process class with that local file as input.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top