Jimbo99999
asked on
VB.Net - System.IO.File.Move with Elevated Privileges
Good Day Experts!
I have developed a small SA VB.net exe to move files on one of our network paths. My searches on the net have been inconclusive.
It works fine when I execute it from my machine as I have Administrator privileges. However, when I put it on the User machine it does not work due to lack of permissions.
How can I elevate the privileges of the User in the code to be able to execute System.IO.File.Move?
Thanks,
jimbo99999
I have developed a small SA VB.net exe to move files on one of our network paths. My searches on the net have been inconclusive.
It works fine when I execute it from my machine as I have Administrator privileges. However, when I put it on the User machine it does not work due to lack of permissions.
How can I elevate the privileges of the User in the code to be able to execute System.IO.File.Move?
Thanks,
jimbo99999
check https://www.experts-exchange.com/questions/28021897/write-file-with-alternate-credentials-with-visual-basic-net.html?anchorAnswerId=38859602#a38859602
the user doesn't have permission from the source or the destination directory?
ASKER
Good Day Everyone
Yes, you are correct...unfortunately due to new rule standards the User does not have permission on the source or destination directory. So, I have been given the task to figure out how to give the User the permissions in my little VB.Net application.
Eric, thank you for the link reference...I will take a look here today.
Thanks,
jimbo99999
Yes, you are correct...unfortunately due to new rule standards the User does not have permission on the source or destination directory. So, I have been given the task to figure out how to give the User the permissions in my little VB.Net application.
Eric, thank you for the link reference...I will take a look here today.
Thanks,
jimbo99999
Isn't this breaking company policy if the user doesn't have access then they should not have programmatic access as well? Only a user with the proper access should be able to move the file.
ASKER
Eric:
I tried the impersonation link information here this morning. Unfortunately I am having a bit of trouble.
My little app is a a windows Form that I load a listview with file to move in a directory. After the User selects the files to move they have to hit a button to execute the move. The trouble I am having is embedding the Impersonation code into the code behind the button.
Is there by chance any references the use Impersonation in a Windows form type application?
Thanks,
jimbo99999
I tried the impersonation link information here this morning. Unfortunately I am having a bit of trouble.
My little app is a a windows Form that I load a listview with file to move in a directory. After the User selects the files to move they have to hit a button to execute the move. The trouble I am having is embedding the Impersonation code into the code behind the button.
Is there by chance any references the use Impersonation in a Windows form type application?
Thanks,
jimbo99999
I found yet another example using a Windows Forms application: http://support.microsoft.com/kb/841699/en-us
ASKER
Thank you kindly Eric...I appreciate the reference. I will try this out today.
Thanks,
jimbo99999
Thanks,
jimbo99999
I just tried the example from http://social.msdn.microsoft.com/Forums/en-US/fe8af53c-4912-49c3-9992-5bbeea32b29d/impersonation-to-copy-file?forum=vblanguage and it is working.
It will be the subject of my next article to be published in the next few days!
It will be the subject of my next article to be published in the next few days!
ASKER
I am looking at that one too...thanks for the good info I really appreciate it.
jimbo99999
jimbo99999
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent! Just sitting down to give it a try.
Thanks,
jimbo99999
Thanks,
jimbo99999
ASKER
I am officially impersonating. Thanks for the help...excellent article!
Thanks,
jimbo99999
Thanks,
jimbo99999