XML- file & network- access
I have a program witch reads a xml file. When i run it in c: it works but when I try it from network it can not read the xml file. I got an IO Permission exception. What do I have to configure?
Thanks!
I have a program witch reads a xml file. When i run it in c: it works but when I try it from network it can not read the xml file. I got an IO Permission exception. What do I have to configure?
Thanks!
I try it in Project Properties to define a new assembly with a strong name. Then I copy myProgram.exe in the Intranet but it does not work? Do I have to do something else?
If you cannot fix it, I suggest posting the full contents of the exception message.
How can i give the program the access rights? I tried from Project, Properties, Security, FileIOPermission. But with out success!
My exception is:
Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Cultural=neutral,PublickeyToken=b77a5c561934e089.
Is that right?
public bool load(string fileName)
{this.fileName = fileName;
try
{ FileIOPermission fp = new FileIOPermission(FileIOPermissionAccess.Read, this.fileName);
PermissionSet ps = new PermissionSet(PermissionState.None);
ps.AddPermission(fp);
XmlTextReader reader = new XmlTextReader(this.fileName);
reader.XmlResolver = new XmlSecureResolver(new XmlUrlResolver(), ps);
xmlDoc.Load(reader);
root = xmlDoc.DocumentElement;
nodeIndex = -1;
element = new XmlNode[3];
return true;
} catch (Exception ex)
{Console.WriteLine(ex.Message);return false;}
}