tags:

views:

1151

answers:

4

I'd like to save some simple text data to a file from my Silverlight app - to a CSV file.

The user presses on a button, the code generates the contents of the file in memory (a string), then a prompt appears asking to either open the file or Save to disk, like through a normal web page.

I found a complicated way to do it: http://pagebrooks.com/archive/2008/07/16/save-file-dialog-in-silverlight.aspx

But wondered if there was a simpler way? Especially with the recent release of Silverlight 2.0.

Thanks.

+3  A: 

Hi Mike,

Right now Silverlight 2 doesn't support saving directly to the user's disk even with a prompt. It is a feature being considered for future versions, but the work around of having the server push out the data is the current solution.

Tim Heuer
A: 

Thanks for letting me know.

I'll use the server push method for now.

You should rather add your comment to the answer from timheuer.
Craig Nicholson
A: 

I do this right now with Silverlight 2.0, but the key is that the files are saved on the web server that hosts the Silverlight apps, by having the Silverlight app call web services.

Probably not what you are looking for, but this is an option.

  • Silverlight app calls web service, that posts the string
  • Web service saves the string as a file on the server
  • File is available through web app, or other means
pearcewg
A: 

Just to update this thread -- Silverlight 3 has this capability now.

Tim Heuer