Hi Nick,
At a quick view, I think you may try to pass the FileStream reference to
the plugin.
using System;
using System.Security;
using System.Collections;
using System.Security.Policy;
using System.Security.Permissions;
using System.IO;
namespace ConsoleApplication32
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
FileStream f = new FileStream(@"C:\test.txt",FileMode.Open);
PermissionSet ps= new PermissionSet(PermissionState.Unrestricted);
ps.Deny();
ClassLibrary9.Class1 cls = new ClassLibrary9.Class1();
byte[] rt=cls.hello(f);
f.Close();
}
}
}
using System;
using System.IO;
namespace ClassLibrary9
{
public class Class1
{
public Class1()
{
}
public byte[] hello(FileStream f)
{
byte[] a=new byte[255];
f.Read(a,0,255);
//f = new FileStream(@"C:\1.txt",FileMode.Open); //this line will failed
becaused of security exception
//f.Read(a,0,255);
return a;
}
}
}
You may have a try to see if this works for you.
If I have any new information, I will update with you.
If you have any quesiton on this problem please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.