Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi !

I've to write a simply program to create zip file in silverlight and I've problem with saving my zip file on local disk. Every time I try to do that I receive error "File operation not permitted. Access to path ("path...") is denied" Is there any way to do that without IsolatedStorageFile ? I try to save zip file in my project folder but it didn't help.
Posted

You can access the local file system from a regular in-browser Silverlight app, but only through a "Save as" dialog (see SaveFileDialog Class[^]), and this dialog must be user-initiated (like on a button click handler).

For example:
private void saveButton_Click(object sender, RoutedEventArgs e)
{
    SaveFileDialog sfdlg = new SaveFileDialog();
    sfdlg.Filter = "ZIP Files (*.zip)|*.zip";
    if (true == sfdlg.ShowDialog())
    {
        using (Stream fs = sfdlg.OpenFile())
        {
            // use the stream "fs"
        }
    }
}
 
Share this answer
 
v3
You cannot access the client side file system from a Silverlight app unless it's configured to run out-of-browser. Even then, you can only access a special folder created on the client system. It's a security thing.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900