I've got a security exception when I try to create filestream
FileStream f = new FileStream(filename, FileMode.Create); Even when I set filename as D:\filename.xml(even not on disc C:).
How to resolve this problem?
Probably Silverlight application hasn't access to disk D for writing. Typically SL application runs in partial trust. You can try to use required elevated trust.
There is similar question - Silverlight 4.0 FileStream
If you're building an Out-of-browser Silverlight application, go to your Project Properties and check "Enable running application out of browser".
Inside "Out-of-browser settings" check "Require elevated trust when running outside the browser".
Also, make sure the user running the application has permission to create/write to the destination path.