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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: