Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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, I've 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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...