security exception System.Security.Permissions
I need to run an application from a network drive.
It reads database information and puts it into a datagrid.
Whenever I click on 'get data' button I get a security exception.
I looked into System.Security.Permissions on MSDN, but I can't find what I'm looking for.
Thank you for your help.
[338 byte] By [
dky1e] at [2007-11-17 15:43:08]

# 1 Re: security exception System.Security.Permissions
Hallo, I read your Problem.
I have the same problem, too.
If your have any solution to this problem. Please write it to me.
Many thanks.
Gab
mailto: gabberhead@bigfoot.de
# 2 Re: security exception System.Security.Permissions
Help about this subject from MSDN:
--------------------------------
You attempted to create a project on a UNC path. By default, a UNC path is not a "trusted" location for a project. Your project may not run correctly when you attempt to debug or run from this location.
For more information, see Configuring Security Policy.
The following tools modify the policy affecting the file share.
.NET Framework Configuration Tool (Mscorcfg.msc)
Code Access Security Policy Tool (Caspol.exe)
Mscorcfg.msc
One (simple) way to modify the policy affecting a file share is to give a specific file share FullTrust permission using mscorcfg.msc. You must be an administrator on the computer to make this change.
To give a file share FullTrust permission
1. Start mscorcfg.msc.
2. Expand the security node, the Machine node, the Code Groups node, the All_Code node, and then highlight the LocalIntranet_Zone node.
3. In the right pane select Add a new child code group to this code group.
4. Choose Create a new Codegroup, then click Next.
5. Choose a Condition Type of URL, then add the .NET Framework SDK to the share location of your project. Click Next.
6. Choose Use Existing Permission Set of FullTrust. Click Next.
7. Select the Exclusive check box. Click Finish.
8. Right-click the security node, select Save All, and select Yes.
9. Restart Visual Studio.
Caspol.exe
Using caspol.exe to accomplish this change, you would use the following command line (you must be an administrator on the computer to make this change.):
caspol -m -ag 1.2 -url urlname FullTrust
--------------------------------
I think it might solve the issue.
# 4 Re: security exception System.Security.Permissions
If you are using win2k have a look in your administrative tools folder under control panel
you should see a icon called
Microsoft .NET Framework Configuration
there is where you configure your security policys.
You can be lazy and give full trust to intranet zone..
or you can be like me and sign all your assemblies with a priivate key and set it up to give full trust to assemblies signed with that particular key.
There is a .net wizards somewhere where you can trust selected assemblies as well..