SqlClientPermission from shared disk drive

andrewsc

Member
Joined
Sep 12, 2003
Messages
7
Location
Sydney, Australia
Hi,

my little console utility works perfectly from C: drive. It connects first to Sql Server, and then reads and writes a few files. The same utility fails when I place the assembly file on a shared disk drive.

Code Access Security makes an interesting reading, but not when I need to make it happen in the next hour or so. Is there any simple command which I can compile into the source, to make it work on shared drives as well ?

The funny thing is that the failure is on the SqlConnectio.Open() call. The error message says the "request for permission SqlClientPermission failed". From my summary reading, I would have expected FileIOPermission to depend on the disk location. But SqlClientPermission ?

On the other hand, I will need to address permissions for file I/O as well, because that is the next thing my programm does, after connecting to SQL Server.

Being in a hurry, Ive tried declarative security:

<assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, Name := "FullTrust")>

The above came back at runtime with an error saying the permission could not be acquired.

Any other quick-fix idea ?

Meanwhile I will keep reading on.
TIA,

Andrew
 
the following seems to do the rick, if I run it before I execute my Dot net program:

caspol -s off

But I hate the idea of completely turning off Code Access Security, on an entire server. All I need is to allow my program to connect to SQL and do file IO, while executing from a shared drive.
 
Back
Top