blah blah blah is here! blah blah » Close

up0down
link

I'd used System.IO; in my winform application so that I can copy files (backup original file) from one Drive to another drive using File.Copy(); thing.

My Network Folder is having "Read/Write" access to all users, but still my Full Trust application is not able to access files on the Network.

Error: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Application's Page_Load Logic will copy the file from the backup folder "IF" the original file is missing. But the application Prompts for a missing file even if the file is existing, then while trying to copy... application crashes.

public static class Paths
{
private const string sourcepath = "V:\\Common\\gsvirdi\\";
private const string bakpath = "E:\\gsvirdi\\backup\\";
public const string filename = sourcepath + "news.dat";
public const string bakfilename = bakpath + "news.bak";
}

Calling it with if (File.Exists(Form1.Paths.filename));

last answered one year ago

1 answers

up1down
link

as it appears this is not an IO error but its an oledb error. check your application if its using impermissible database transaction like calling a database or smthg and if it didn't work then enable the permision for oledb to remove ur headache :) by setting the application policy.

muster
1556

here is the permission error info on msdn: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbpermission.aspx and this is the code access security: http://msdn.microsoft.com/en-us/library/0x4t63kb.aspx

gsvirdi
412

I was trying to access the exe file from the network location n I faced Error, later I observed that accessing the file from desktop (or local computer) does not gives any error. I'm not sure about the OleDb thing... but I feel that mentioning drive letter V: also must have done some unplesant magic in the working of the file from network drive. I will look at the msdn page now... thx so much for ur Prompt reply.

Feedback