开发者

Permissions for writing a file

开发者 https://www.devze.com 2022-12-21 12:38 出处:网络
I\'ve the following issue I\'ve a windows application It calls a remote web service (for authentication)

I've the following issue

  • I've a windows application
  • It calls a remote web service (for authentication)
  • It in turns call a web service (in the same remote machine) (to get a licensed file)
  • It saves the licensed file in All Users/Application Data in the system where the application is running

Which permission is used for saving the file in the Application Data folder? Either the web service's or the currently logged windows user's?

Update #1

So, i'm not able to save the license as the web service call is throwing a save error. How can i check the permissions of the folder?

Here is the code for creating my folder

licensePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MyApp");
            if (!Directory.Exists(licensePath))
                Directory.CreateDirectory(li开发者_如何学编程censePath);

Update #2

If i try to save it in the application's path itself (in bin/debug while debugging the application), it is working fine. Any ideas? I've tried just "C:\test" too. It's not working.

Thank you.

Regards NLV


It will save the file with the permissions of the user that is running the windows application (which can be different from the logged in user - see RunAs).


The permission the windows application is running in.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号