hi
i had develop a simple program using vb.net with ms access
it run with no error on my local
but if i put it on a share network
i face a problem throw out by the system stating the error below
"request for the permission of type 'system.data.oledbpermission,system.data,version=, culture=neutral,publickeytoken=b77a5c561934e089'failed."
anyone why did tis happen?

Dani AI

Generated

The exception you saw — a refusal to grant System.Data.OleDbPermission — is the CLR denying a permission demand under Code Access Security (CAS). In .NET 2.0 assemblies loaded from network locations run with reduced trust by default, so the System.Data provider cannot get the OleDb permission it needs to open an Access database. That explains why running the same executable locally works while launching it off a UNC share fails.

If installing the app on each client (the approach suggested) is not possible, two practical alternatives are:

  • Add the UNC path to a machine-level trusted code group with caspol (requires administrator rights). Example (run an elevated command prompt and replace \server\share with your path):
caspol -m -ag 1 -url "file://\\server\share\*" FullTrust -n "MyNetworkShare"

This grants FullTrust to assemblies under that share; use a narrow path/pattern to reduce risk. See the CASPOL documentation for details: caspol.exe (Code Access Security Policy Tool).

  • If you can move to .NET Framework 4+, consider configuring the runtime to allow remote loads instead of changing policy:
<configuration>
  <runtime>
    <loadFromRemoteSources enabled="true"/>
  </runtime>
</configuration>

That element changes how assemblies loaded from remote locations are treated; see the docs: loadFromRemoteSources element and the general CAS overview: .

Troubleshooting tips: confirm the .NET version (message referenced System.Data, v2.0.0.0), test by copying the EXE locally, and apply the smallest-scope trust you can. Use these changes carefully — granting FullTrust to network locations has security implications.

Recommended Answers

All 2 Replies

I understand that it is a windows forms application. Not a web one.

Do you have checked, in the application properties, security tab, the Enable ClickOnce, then the partial trust application, and calculated the permissions for local intranet? Or just set it as a full trust application?.

Putting the application into a share, for run purposes, is generally not a good idea because the application should be installed on the local PC. The installer registers the assemblies into the local PC GAC (Global Assembly Cache)

The Access database can be put on a share, but you'll need to define the path as trsuted by access on every client. And must have also crete/delete files permission for the access lock management.

Hope this helps

I understand that it is a windows forms application. Not a web one.

Do you have checked, in the application properties, security tab, the Enable ClickOnce, then the partial trust application, and calculated the permissions for local intranet? Or just set it as a full trust application?.

Putting the application into a share, for run purposes, is generally not a good idea because the application should be installed on the local PC. The installer registers the assemblies into the local PC GAC (Global Assembly Cache)

The Access database can be put on a share, but you'll need to define the path as trsuted by access on every client. And must have also crete/delete files permission for the access lock management.

Hope this helps

hi,
followed your suggest to installer the register the assemblies into the local pc and putting the access database on share
it works charm
thanks for it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.