Skip to main content

Microsoft Silverlight

Answered Question download a zip file to user computerRSS Feed

(0)

ScCrow
ScCrow

Member

Member

44 points

107 Posts

download a zip file to user computer

I have a helper class/project in my solution. In its dir is a subdir named "Resources" which holds various files, one is a .zip.  In the Class, I have a method that is called to create a PopUp window to do a download and allow a user to save the zip  to their computer. Below are just a couple of the attempts 

I cant seem to get the Uri correct. 

          HtmlPage.Window.Navigate(New Uri(".\Resources\" & inField, UriKind.Relative))

          System.Windows.Browser.HtmlPage.Window.Navigate(New Uri("Resources\" & inField, UriKind.Relative))

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: download a zip file to user computer

I don't believe that is going to work. The problem is that Silverlight can only download things to the user's computer from the server, not from the xap file that is local. So you're trying to navigate to a file that is already downloaded and on the local machine.

If you really need this to be deployed with the Silverlight xap, you could write some server code for application_start that would check to see if the zip file existed locally and if it didn't you would break open the xap file (as a zip file) and extract the zip file to a local folder on the web server.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

ScCrow
ScCrow

Member

Member

44 points

107 Posts

Re: download a zip file to user computer

Bryant

Its one of those newbee errors.  I was thinking that the resource was on the server.  Obviousely not.  Duh! 

Ive done this with asp.net pages, but not from Silverlight. It doesnt have to be in Silverlight,,, just initiated when the user clicks a download button.  Sooo, I need a quick re-think.  If anyone has a link to a sample, it would save some time.

Thanks 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities