mikehamer
mikehamer

Reputation: 53

Silverlight 2.0 - Saving to a text file

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.

Upvotes: 1

Views: 1766

Answers (3)

Tim Heuer
Tim Heuer

Reputation: 4301

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

Upvotes: 1

pearcewg
pearcewg

Reputation: 9613

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

Upvotes: 0

Tim Heuer
Tim Heuer

Reputation: 4301

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.

Upvotes: 3

Related Questions