Groups | Blog | Home
all groups > dotnet clr > october 2003 >

dotnet clr : ERROR : System.Security.SecurityException


Ali
10/29/2003 8:13:49 AM
I am getting the following error:

System.Data.SqlClient.SqlClientPermission, System.Data, Version 1.0.5000.0,
Culture=neutral, PublicKey Token=b77a5.... Failed.

My code uses a reference to System.Data, tries to connect to my datatabase
to retrive a couple of records. That's all. The error occurs when I try to
open the connection.

I checked my security listgroups (using caspol -lg) and everything looks
normal.
I run caspol -reset
I removed and added the reference to System.Data making sure it is coming
from the same server. Actually, my application is on the E: drive and the
Microsoft.Net framework is on the C: drive.

Please share any ideas on how to solve this problem. I thought that all
mscorlib stuff is fully trusted.

Ali

nhertl NO[at]SPAM microsoft.com
10/30/2003 8:24:13 AM
It sounds like you might have a problem with your connection string. This
type of error is not the result of the CLRs code-based security, but rather
of the interaction with your database. It will only grant authorized users
access to its data. You will probably need to focus attention on the
connection string rather than the location of resources and code-based
security.

Hope this helps,
--Nick
shawnfa NO[at]SPAM online.microsoft.com (
11/5/2003 12:18:59 AM
Hi Ali,

Is it possible that your E: drive is not a local drive, and is instead a drive mapped to some network share (or even a share off of your local
machine)? If this is the case, then even though it appears as a local drive, code run off of this drive will be from the LocalIntranet zone. You can find
out what code groups are getting matched to this code by running

caspol -rsg YourApp.exe

If this is the case, then you'll need to provide more trust to your assembly. I've provided some details on how to do this in a blog entry:
http://blogs.gotdotnet.com/shawnfa/PermaLink.aspx/40884dc9-dbb7-48e7-a70f-5f1f4627410c

-Shawn

--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.
--------------------
[quoted text, click to view]
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.adonet,microsoft.public.dotnet.framework.clr,micr
osoft.public.dotnet.framework.remoting,microsoft.public.dotnet.framework.sdk,microsoft.public.dotnet.fr
[quoted text, click to view]
microsoft.public.dotnet.framework.clr:8477 microsoft.public.dotnet.framework.remoting:13879 microsoft.public.dotnet.framework.sdk:7997
microsoft.public.dotnet.faqs:12217
[quoted text, click to view]

AddThis Social Bookmark Button