I need to write string to an xml file in Silverlight. When I used the following code, the above mentioned exception "Attempt to access the method failed: System.IO.StreamWriter..ctor(System.String, Boolean)" has occurred.
using (StreamWriter sw = new StreamWriter("C:\T开发者_如何学JAVAest.xml", false)) { sw.Write(root.ToString()); }
Can anyone help me out in doing writing to xml file in Silverlight?
Silverlight is in a sandboxed mode where it has restricted access. You can write to "Isolated Storage", but you cannot create files on their hard drive.
http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile(VS.95).aspx
http://forums.silverlight.net/forums/p/22011/77243.aspx
精彩评论