Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3439782
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:21:10+00:00 2026-05-18T08:21:10+00:00

the following piece of code worked fine all day yesterday public Image getImage() {

  • 0

the following piece of code worked fine all day yesterday

public Image getImage()
    {
        String connectionString = "URL GOES HERE, CANT POST WORK DATA";
        Image img;
        HttpWebRequest request = WebRequest.Create(connectionString) as HttpWebRequest;
        using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
        {
            StreamReader reader = new StreamReader(response.GetResponseStream());
            img= Image.FromStream(reader.BaseStream);
        }

        return img;
    }

It gets an image from a webservice provided by work, i used it a lot yesterday for the day but now all i get is the exception stated in the header on the line

img= Image.FromStream(reader.BaseStream);

the problem is its working for everyone else apart from me (you can manually type the url in to your browser and it displays the image in there, this is not working for me either)

Does anyone have any ideas?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:21:10+00:00Added an answer on May 18, 2026 at 8:21 am

    Two things:

    1) The StreamReader is of not use, it’s only used for Text streams, you can use response.GetResponseStream() directly

    2) The doc for Image.FromStream available here says “You must keep the stream open for the lifetime of the Image.”, so you must not create the stream with the ‘using’ statement, as it will be closed at block end.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following piece of code worked fine if garbage collection was not turned on
I have this following piece of code: public TimestampedRowStorage GetTimestampedRowStorage(string startTime, string endTime, long
the following piece of code works fine when i use it among some code
The following piece of code runs fine when parallelized to 4-5 threads, but starts
I have the following piece of code in my Model: public function getSite() {
The following piece of code worked well in one program and caused a bus
I have the following piece of code: class ICookable { public: virtual void CookMe
I have following piece of code: public void ProcessRequest (HttpContext context) { context.Response.ContentType =
The following piece of code works perfectly in all browsers, bar IE. As usual.
The following piece of code namespace ConsoleApplication1 { class Program { static void Main(string[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.