Click here to Skip to main content
15,935,728 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to download a zip file and then extract to read it. Plz help
Sandeep Mewara 27-Jan-11 3:50am    
Did you try anything? Google?
himani_jha 27-Jan-11 5:23am    
public MainPage()
Uri uri = new Uri("OnlineTv;component/", UriKind.Relative);

// Download the zip package.
WebClient webClient = new WebClient();
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);

void webClient_OpenReadCompleted(object sender,
OpenReadCompletedEventArgs e)
// Extract the desired image from the zip package.
Stream zipPackageStream = e.Result;
Image image = LoadImageFromZipPackage(
"Tulips.jpg", zipPackageStream);

public Image LoadImageFromZipPackage(
string relativeUriString, Stream zipPackageStream)
// Get the image stream at the specified URI that
// is relative to the application package root.
Uri uri = new Uri(relativeUriString, UriKind.Relative);
StreamResourceInfo zipPackageSri =
new StreamResourceInfo(zipPackageStream, null);
StreamResourceInfo imageSri =
Application.GetResourceStream(zipPackageSri, uri);

// Convert the stream to an Image.
BitmapImage bi = new BitmapImage();
Image img = new Image();
img.Source = bi;

return img;

Stream zipPackageStream = e.Result;
here I m getting error An exception occurred during a WebClient request
mayurdhwajsinh 10-Aug-11 3:02am    

I am getting following error in the webClient_OpenReadCompleted event

{"An exception occurred during a WebClient request. "}
System.InvalidOperationException {System.Net.WebException}


Take a look here. This should get you started:
Share this answer
Specialized port for SL and WP7 -
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900