• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Vista and XP permissions problem

How do you make sure the installation directory allows writing by the user?  How can you make sure to change the settings in a Deployment project?
0
ddepuemd
Asked:
ddepuemd
  • 3
  • 2
1 Solution
 
CraigLazarCommented:
Hi,
I think the machine must have admin writes in order to install applications especially any adjustments to the registry. Most installs effect the registry,
 
0
 
ddepuemdAuthor Commented:
I have tried this:

 Dim CurrentPath as String = "C:\TestPath"
 Dim UserName as String = system.environment.username
 
 Dim dInfo As New DirectoryInfo(CurrentPath)
 Dim dSecInfo As DirectorySecurity = dInfo.GetAccessControl(AccessControlSections.Access)
 Dim myRuleValue As Integer = 0
 
 myRuleValue =  FileSystemRights.FullControl   'Add your wanted Access here
 Dim myRule as FileSystemAccessRule
 myRule = New FileSystemAccessRule(UserName myRuleValue, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit Or InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)
 dSecInfo.AddAccessRule(myRule)
 dSecInfo.SetAccessRule(myRule)
 dInfo.SetAccessControl(dSecInfo)

but it fails because it is not giving permission for the function to set the rule.  Any ideas on how to set the rule as administrator???
0
 
ddepuemdAuthor Commented:
currentpath should have been curdir()
0
 
ddepuemdAuthor Commented:
I've modified the code to write that database to the users directory instead of program files...
0
 
CraigLazarCommented:
good stuff well done, :)
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now