troubleshooting Question

ASP .NET HttpWebRequest.GetResponseStream()

Avatar of at999
at999 asked on
ASP.NET
11 Comments2 Solutions831 ViewsLast Modified:
I have a servlet page- http://mylink/servletpage which reads a JPEG image file and writes bytes to a servletoutputstream... So when i open the link i can actually see that image file on the browser.

Now i want to read that Output stream using .NET...

So i wrote this code -
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(" http://mylink/servletpage");
                     
        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
        Response.Write(" myHttpWebResponse.ContentType " + myHttpWebResponse.ContentType) ; //THIS CONTENT TYPE IS ALWAYS JPEG
        // Gets the stream associated with the response.
        Stream receiveStream = myHttpWebResponse.GetResponseStream();

Now i want that response-stream back to a JPEG file...

Pl help

thanks

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros