Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i write a file on the client's PC using silverlight

I need to write a web application that allows the client to download a file from the server, so far so good, but the file must be kind of encoded, so i need to decode it on the client and write it on a file on the client's PC.

Can i do this using Silverlight? and how?

If it is not possible, there is another way to do it?. Any suggestions?

Thanks

Edit: As exposed for Brian Genisio, i can ask for user permision to save the file, so i think that the open and save Dialogs are ok for my case. But in case that that's not enough, is there a way to, with or without user interaction, to save the file outside of the isolated storage, for example emulating a new download for the user?

like image 781
DkAngelito Avatar asked Apr 15 '09 20:04

DkAngelito


3 Answers

In Silverlight 3.0, you will have access to read and write files via the OpenFileDialog. In Silverlight 2.0, you have access to Isolated Sotrage, which will let you save to a sandbox. You will probably never have full access to the file system without user permission, though.

like image 180
Brian Genisio Avatar answered Nov 20 '22 09:11

Brian Genisio


You can use IsolatedStorageFile Class for this using silverlight.

Another link: How to Read and Write files in the Isolated Storage?

like image 39
Gulzar Nazim Avatar answered Nov 20 '22 10:11

Gulzar Nazim


You cannot do this for security reasons:

Silverlight-based applications do not use the file system of the operating system and are restricted to using isolated storage to persist and access files, so this namespace [System.IO] does not provide any additional functionality. For more information about how Silverlight-based applications use isolated storage, see Isolated Storage.

If possible, you might want to shift it such that the server does the encoding and the file is made available for download in a traditional manner.

If you're encoding for privacy/security consider offering the download only on a secure protocol (HTTPS using SSL).

like image 3
Ben S Avatar answered Nov 20 '22 08:11

Ben S