Click here to Skip to main content
15,891,851 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await InstallationFolder.CreateFileAsync("MyDocument.Txt", CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(file, "Hello");


The error is:

An exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll but was not handled in user code
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
If there is a handler for this exception, the program may be safely continued.
Posted
Comments
Richard MacCutchan 8-Oct-12 9:09am    
Access is denied.
This should give you a clue; you are not allowed to write into the target folder.

1 solution

As you can read in the MSDN documentation available at http://msdn.microsoft.com/en-us/library/windows/apps/hh967755.aspx[^]:

The app's install directory is a read-only location.
 
Share this answer
 
v2
Comments
Richard MacCutchan 8-Oct-12 10:59am    
If you knew the answer, why did you post the question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900