laptop_01 Posted November 8, 2003 Posted November 8, 2003 Hi I have a vb application that passes a file name (a string that defines the full path for a file) to a C# DLL. I verified that the string is being passed fine. Problem is that as soon as I try to do this: FileInfo fiFile = new FileInfo(inFile); I get this exception: C# Exception: Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. C# Exception: at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken) at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride) at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) at System.Security.CodeAccessPermission.Demand() at System.IO.FileInfo..ctor(String fileName) at CedarToXML.CedarXmlMain.ConvertFile(String inFile, String outFile, String styleSheetName, String[]& response) in l:\c#projects\cedartoxml\cedarxmlmain.cs:line 73 C# Exception: C# Exception: Thrown ByVoid CheckHelper(System.Security.PermissionSet, System.Security.PermissionSet, System.Security.CodeAccessPermission, System.Security.PermissionToken) I tried adding this int inFilePathMarker = inFile.LastIndexOf('\\'); string inFilePath = inFile.Substring(0,inFilePathMarker - 2); FileIOPermission filePerm = new FileIOPermission(FileIOPermissionAccess.Read, inFilePath); FileInfo fiFile = new FileInfo(inFile); But this still did me no good. I am using the VS IDE to compile and link the DLL and I can see that the assembly was registered. I need the dll to be used by the general public. I am hoping that I won't have to hard code the inFile in my dll :-\ :-\ Quote
mocella Posted November 10, 2003 Posted November 10, 2003 What is the value of inFilePath when you attempt to create the FileIOPermissions? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.