Permissions for writing a file
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.
精彩评论