Many thanks.it works well in my lan but in another one (in my work) I must make caspol -s off, even I use:
PermissionSet ps = new PermissionSet(PermissionState.Unrestricted ) ;
ps.AddPermission(new FileIOPermission(FileIOPermissionAccess.AllAccess ,Application.StartupPath+"\\" ) );
ps.AddPermission(new EnvironmentPermission(EnvironmentPermissionAccess.AllAccess,Application.StartupPath ));
ps.AddPermission(new ZoneIdentityPermission(SecurityZone.Intranet));
ps.AddPermission (new SqlClientPermission(PermissionState.Unrestricted) );
ps.AddPermission(new SecurityPermission(PermissionState.Unrestricted ));
ps.AddPermission (new UIPermission (PermissionState.Unrestricted));
ps.Assert() ;can I change it from my code?thanks.