Mobile Incubation Week – Tough Questions

What I'm doing this week

I'm in the Galileo room at the Silicon Valley Mountain View Campus at Mobility Incubation Week. I'm the on-site technical resource to help teams prepare an application to run on the mobility platform.

At the end of the week there will be a winner with the best mobile application and I'm excited to see how the week onfolds.   

One team is trying to build a notification system to alert customers about problematic deliveries

Silverlight Question
Their site wants to be able to save files locally to disk. But Shawn writes,

Shri Borde's WebLog

If you implemented a text or image editor in Silverlight, the user would not be able to save the edited file to disk.

However, there is a workaround - but at the cost of extra network traffic.

  • The solution involves the following steps:
  • The Silverlight client app running in the browser sends the data that needs to be saved to disk to the web server using a POST operation using System.Windows.Browser.Net.BrowerHttpWebRequest::GetResponse
  • The web server saves the data to a temporary file and returns a URL for the temporary file in the response
  • The Silverlight client app reads the URL that is returned in the System.Net.HttpWebResponse object.
  • It navigates to the URL using System.Windows.Browser.HtmlPage::Navigate.
  • This will result in the browser invoking the default action for the given file type.
  • This is often to prompt the user to save the file to disk.
  • If the browser opens the file directly, the user could then have the browser save the file to disk.
  • If multiple files need to be saved, the web server could save them all in a zip file using System.IO.Compression.GZipStream.
  • This solution is obviously not ideal as it result in unnecessarily sending the data back and forth over the network.
  • For large files, this could be prohibitive.
  • For small files, its a reasonable solution until there is a SaveFileDialog API in Silverlight.

Silverlight 3 – SaveFileDialog

Silverlight 3 has a dialog box that can be used.

Another Post which deomonstrates this solution is:


Skip to main content