Solution To "Folder Access Denied" Error In C#

Most of the developers face this "Access Denied" issue while installing their desktop application on a client system. Often, it happens because your application tries to save some data or read some data from that path or file but the client system doesn't provide rights to access the path.

Problem
 
Most developers face this "Access Denied" issue while installing their desktop application on a client system. Often, it happens because your application tries to save some data or read some data from that path or file but the client system doesn't provide rights to access the path.
 
Specific Example
 
Let's suppose you have built a desktop application and inside that, you have a folder named "Images". During the sign-up process, a user can upload his/her picture that is saved in the "Images" folder. When the users access their profile, their picture should be shown to them.
 
But due to the "Access Denied" issue, the picture is not saved and that's the reason the users are unable to see their picture in account data.
 
Solution
 
There are 2 solutions for this issue.
 
First, you need to run your application always as Administrator. However, this solution is not efficient.
 
So, we have a second solution. You need to perform the following steps while creating an installer. When you add images inside the application data, we need to open the properties of the folder and follow the below steps.
  1. Click Permissions.
  2. Right-click to add a new user.
  3. In Domain, select the"Empty" option and for user field, select "Everyone".
  4. Click OK
  5. In the Permissions section, click on "Full Control" and save.
That's all.