c# - Asynchronous task using Task.Factory.StartNew() -
at point of execution of our project using task.factory.startnew()
creating asynchronous tasks. required delete temporary files. following code using :
task.factory.startnew(function() deletetempdocs(path))
the problem folders may have privilege restrictions. need run tasks administrator rights
. if project not running in admin rights. possible set rights this?
it isn't possible run task administrator rights, rights assigned on process level. have start new process, example batch file, , run administrator.
var process = new process(); var processstartinfo = new processstartinfo(); processstartinfo.verb = "runas"; // runs administrator processstartinfo.filename = "myfiledeleter.exe"; process.startinfo = processstartinfo; process.start(); process.waitforexit();
Comments
Post a Comment