c# - Parameter not valid - System.argumentexception - Image Handling -
the following piece of code worked fine day yesterday
public image getimage() { string connectionstring = "url goes here, cant post work data"; image img; httpwebrequest request = webrequest.create(connectionstring) httpwebrequest; using (httpwebresponse response = request.getresponse() httpwebresponse) { streamreader reader = new streamreader(response.getresponsestream()); img= image.fromstream(reader.basestream); } return img; }
it gets image webservice provided work, used lot yesterday day exception stated in header on line
img= image.fromstream(reader.basestream);
the problem working else apart me (you can manually type url in browser , displays image in there, not working me either)
does have ideas?
thanks
two things:
1) streamreader of not use, it's used text streams, can use response.getresponsestream() directly
2) doc image.fromstream available here says "you must keep stream open lifetime of image.", must not create stream 'using' statement, closed @ block end.
Comments
Post a Comment