Does anybody knows how to fix the exception that occurs when an .EXE file is run from the the Network Share. This application works fine when running from the local machine. I have been trying a lot to fix this issue for a while, but without any success.
Here is the simple code I am trying to test :
string AssessmentFilePath = @"\\abce.com\root\md\it\development\testfile\test.xml";
INetworkFileShareReader reader = new NetworkFileShareReader();
XPathDocument document = reader.GetAssessmentFileFromVendor(AssessmentFilePath);
XPathNavigator nav = document.CreateNavigator();
string rootPath = "/TABLE/APSOUTPUT";
XPathNodeIterator iter = nav.Select(rootPath);
int coutner = 0;
while (iter.MoveNext())
{
coutner++;
Console.WriteLine(coutner);
}
of course, I have no problem running this code from my machine like : c:>abce.com\root\my.exe , assuming my my.exe is the output of this little cosole application.
I would really appreciate if someone can point me to the right direction :
Here is the snapshot of the Exception that I am getting :
Unhandled Exception: System.Security.SecurityException: Request for the permissi
on of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.
0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMa
rk& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at SimpleNetworkShareApp.NetworkFileShareReader.GetAssessmentFileFromVendor(S
tring networkFileLocation)
at SimpleNetworkShareApp.Program.Main(String[] args)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Vers