473,809 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebResponse help

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.Meth od = "POST";

buffer = new byte[urlExecute.Leng th - 1];

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

{

buffer[i] =
(byte)Microsoft .VisualBasic.St rings.AscW(urlE xecute.Substrin g(i,1));

}

webRequest.Cont entLength = buffer.Length;

webRequest.Keep Alive = false;

webStream = webRequest.GetR equestStream();

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

webResponse = (HttpWebRespons e)webRequest.Ge tResponse();
Thanks for the help!
Nov 17 '05 #1
2 4092
Randy wrote:
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.Meth od = "POST";

buffer = new byte[urlExecute.Leng th - 1];

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

{

buffer[i] =
(byte)Microsoft .VisualBasic.St rings.AscW(urlE xecute.Substrin g(i,1));

}

webRequest.Cont entLength = buffer.Length;

webRequest.Keep Alive = false;

webStream = webRequest.GetR equestStream();

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

webResponse = (HttpWebRespons e)webRequest.Ge tResponse();


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,
--
http://www.joergjooss. de
mailto:ne****** **@joergjooss.d e
Nov 17 '05 #2
I believe this is what you want to do:

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

HTH

Ollie Riches

"Joerg Jooss" <ne********@joe rgjooss.de> wrote in message
news:xn******** ********@msnews .microsoft.com. ..
Randy wrote:
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.Meth od = "POST";

buffer = new byte[urlExecute.Leng th - 1];

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

{

buffer[i] =
(byte)Microsoft .VisualBasic.St rings.AscW(urlE xecute.Substrin g(i,1));

}

webRequest.Cont entLength = buffer.Length;

webRequest.Keep Alive = false;

webStream = webRequest.GetR equestStream();

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

webResponse = (HttpWebRespons e)webRequest.Ge tResponse();


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,
--
http://www.joergjooss. de
mailto:ne****** **@joergjooss.d e

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1482
by: amine | last post by:
I really need help on this please. I am writing an application for an Ipaq and I am trying to enable the application to connect to a DAV server which can is basically an HTTP server that acts like an FTP server. I used the following code WebRequest req = WebRequest.Create (url); req.Credentials = new NetworkCredential (username, pass); WebResponse res = req.GetResponse();
1
2961
by: Rajiv Barik | last post by:
hi , I am trying to download a zip file from a http site using webResponse . here's the code WebRequest wReq ; wReq = WebRequest.Create(wUri ) ; wReq.Credentials = new NetworkCredential (_uid,_psswd); wReq.Timeout = 6000000; WebResponse wRes = wReq.GetResponse(); Stream wOutput = wRes.GetResponseStream(); BinaryReader br = new BinaryReader (wOutput);
0
2768
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the idea that costs nothing and it is inheritently built into the Framework. So here is the solution... When you use the WebRequest and WebResponse classes to obtain graphics from a web site, these classes have built-in decoding for JPEG 2000 files....
2
9709
by: gizmo | last post by:
Hi, I'm using the following code to request the html source from the quoted site. ...... string url = "http://www1.soccerstand.com/"; WebRequest webRequest = WebRequest.Create(url); WebResponse webResponse = webRequest.GetResponse(); beginStr = new StreamReader(webResponse.GetResponseStream(),
2
1588
by: trialproduct2004 | last post by:
Hi all. i am having problem at a time of validatiang url. I am using webrequest and webresponse class to get content of particular url. My problem is after using webrequest and webresponse class i want to remove memory allocated by this object. am using close method and after that i am setting it to null. My pronlem is that at a time of setting webrequest to null sometimes it is taking more than 10 minutes. similary at a time of closing...
2
3390
by: Jeff G. | last post by:
Hello everyone, I have read through the newsgroups (thank God for 'em!) extensively looking for an example of how to pass a file (PDF) from a webresponse stream down to a web client. Here's the scenario - when the web browser requests a file, the IIS Server1 has to go back to Server2 to make a request for the file. Server2 then responds the file back to Server1 and Server1 should be able to just forward the file down to the web browser....
1
8207
by: Mr Flibble | last post by:
OK I logon to a web site and I manage to get an SMSESSION cookie that I then store in a variable called _session (a class scoping variable). I do this by calling a logon URL and setting a cookie to SMCHALLANGE=YES to allow me to obtain a session. I then iterate the cookie collection to extract the SMSESSION value. All is good (so far). This is when the sky turns grey and the rain starts to fall. I then use this SMSESSION in a web...
0
1506
by: archana | last post by:
Hi all, I am facing very strange problem while using webrequest. What i am doing is i have one url which i want to validate. so i am using webrequest and webresponse. My code is as below:- try {
3
2340
by: KyleUbenk | last post by:
Well I have a multi-threaded program which downloads URL sources from the web. Im doing this multiple times at once. The only problem I see is that sometimes it takes a while to download the sourceWebResponse ServerResponse = webrequest.GetResponse(); and only one webresponse can happen at once because the rest of the threads seem to wait on the first webresponse to finish. Is there a way around this? I hope you understand what my problem is. ...
4
2132
by: CindyH | last post by:
Hi - hope someone can help with this - this code was working for a while in the 'real' code and then suddenly stopped - not sure what happen. I made two simple forms on localhost to try to test what is going on. I'm not getting any errors right now, but code is not working either - not reading the post in second form or else the first form is not sending it correctly....
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.