TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
khanhkv2002
NA
8
0
Get image file from a website through proxy?
Jan 26 2004 12:34 AM
hi all, I know that I can get an HTML page from a web server through proxy, but I can't get an image file from that web server. Could someone tell me how to do that? Below is my 2 snippets of code that all have errors: //1, using WebRequest: image file to be saved is wrong format, can not view WebRequest req = WebRequest.Create("http://www.google.com/images/logo.gif"); WebProxy myProxy = new WebProxy("http://10.23.23.25:8080", true); req.Proxy = myProxy; WebResponse result = req.GetResponse(); Stream ReceiveStream = result.GetResponseStream(); StreamReader sr = new StreamReader( ReceiveStream ); resultstring = sr.ReadToEnd(); FileStream myFileStream = File.Create("c:\\logo.gif"); StreamWriter writer = new StreamWriter(myFileStream); writer.Write(resultstring); writer.Close(); //2, using WebClient: can not go through proxy WebClient myWebClient = new WebClient(); myWebClient.DownloadFile("http://www.google.com/images/logo.gif","c:\\logo.gif"); Any help will be very appreciated, Thanks Khanh
Reply
Answers (
0
)
Writing/Embedding resource(s) to already compiled exe
Help with treads!!!