caglaror
caglaror

Reputation: 458

In VS2010 with C#, How to get and save an image from URL that sent binary not static image?

There is an url like www.demoimage.com/?imageNo=34, and that url shows an image on the browser. What i need is to save this image to hdd as .jpg , i tried this sample and works http://www.co-scripts.com/url--den-resimleri-binary-olarak-alip-kaydetme But some urls returns 0 bytes of reply tı my httprequest. I change the request header, timeout, userAgent, buffer etc. But failed again. Why some urls returned 0 bytes while it renders as image on standart browsers like ie 8, chrome, mozilla? PS: I need to save as file, not to save to any sqllike etc. databases Thank you Caglar

Upvotes: 0

Views: 324

Answers (1)

dexter
dexter

Reputation: 7203

In short you will have to use WebRequest and WebResponse classes to get the image stream.

Upvotes: 1

Related Questions