Set permission to read local XML file in C# for XAML browser app

camachb

New Member
I have a XAML Browser Application that will eventually be placed on a server, however I am currently testing it from my Documents folder. I am trying to read from an XML document locally, but I am stuck at \[code\]XmlReader.Create();\[/code\]When I tried to use my XML document, a SecurityException was thrown, so I tried to use the following to bestow read permission upon the XML file:\[code\]FileIOPermission fpa1 = new FileIOPermission(FileIOPermissionAccess.Read, @"C:\Users\User1\Documents\Visual Studio 2010\Projects\WpfBrowserApplication2\WpfBrowserApplication2\XMLDoc1.xml");xReader = XmlReader.Create(@"C:\Users\User1\Documents\Visual Studio 2010\Projects\WpfBrowserApplication2\WpfBrowserApplication2\XMLDoc1.xml"\[/code\]The error message reads:\[code\]A first chance exception of type 'System.Security.SecurityException' occurred in mscorlib.dllRequest for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=[tokennumber]' failed.\[/code\]Is FileIOPermission the correct class to use to enable read permission with an XmlReader?
 
Back
Top