I want to write a simple text file from my winform app in c# directly to the user's desktop and not be denied. How can I get the path? Thanks in advance.
Use Environment.SpecialFolder to get the path to the desktop. You may need to run elevated to write to this folder.
Edit: You also need to ensure that your administrative user has access to the desktop folder. For example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With