I am using the following code to open up an XML file so that I can utilize it for content management:
//Initialize and load xmlDoc
XmlDocument XMLDoc = new XmlDocument();
XMLDoc.Load("E:\\foldername\\Content.xml");
FileStream fileStrm = new FileStream("E:\\EightFoldDev\\Content.xml", FileMode.Open);
XMLDoc.Load(fileStrm);
fileStrm.Close();
However I am getting an error:
"The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
I have been looking around online but haven't been able to find a solution yet. I tried adding the following to web.config but had no luck.
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>
It works on my local machine fine but when I push it up to the server (hosting provided by WinHost), I get the error. So I'm sure there's something I am missing in permissions.
Any help is appreciated!