I'm building an ASP.NET C# website, one of the files contains Word Docs and PDF files which I want to block access to, unless they know the password. I tried the FileIOPermission Class using full path and relative path with no luck.
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.NoAccess, @"resources");
f2.AddPathList(FileIOPermissionAccess.NoAccess | FileIOPermissionAccess.NoAccess, @"resources");
try
{
f2.Demand();
}
catch (SecurityException s)
{
//Console.WriteLine(s.Message);
}
Response.Redirect(@"resources/20019_05_05_DOCS.zip");
I am testing the code, expecting to get access denied, but I can still access the files in the resource folder . Thank you.