Application Defaults to Saving in a Protected Directory (UAC)

Application Defaults to Saving in a Protected Directory

Some applications allow users to save or export data to their local computer. Often, the dialog box defaults to places like C:, to which standard users do not have write permissions. In addition, some applications do not respond well when the code to write the file fails because as a result of an access denied from the operating system.

Resolution

Assume that users can only write to their own profiles. For documents intentionally saved by users, initialize the dialog boxes to start at Documents (Environment.GetFolderPath(Environment.SpecialFolder.Personal). Remember that the Save dialog box will allow a user to browse to other locations than the user's profile, so the application should include logic to ensure that it fails gracefully if a user choose a different directory than those located in his/her profile.

See Also

Concepts

Troubleshooting UAC