Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:53:28+00:00 2026-06-17T15:53:28+00:00

Wow, is this way more complicated than it needs to be. Can someone explain

  • 0

Wow, is this way more complicated than it needs to be. Can someone explain to me why the following code works:

       string stringToWrite = "SomeStuff";
        Windows.ApplicationModel.Package package = Windows.ApplicationModel.Package.Current;
        Windows.Storage.StorageFolder installedLocation = package.InstalledLocation;
        var files = await installedLocation.GetFilesAsync();
        foreach (Windows.Storage.StorageFile sf in files)
        {
            if (sf.Name.Equals("log.txt"))
            {
                await FileIO.AppendTextAsync(sf, stringToWrite);

            }
        }

And yet the following fails with AccessDenied:

      Windows.ApplicationModel.Package package = Windows.ApplicationModel.Package.Current;
      Windows.Storage.StorageFolder installedLocation = package.InstalledLocation;
      var log = await installedLocation.GetFileAsync("log.txt");
      await FileIO.AppendTextAsync(log, stringToWrite);

The only difference is looping through the files returned by the GetFilesAsync method vs getting the file by name. By the way, getting the file by name works because if I misspell log.txt in GetFileAsync, I get an exception.

Very confusing….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:53:29+00:00Added an answer on June 17, 2026 at 3:53 pm

    You should not be using your installed location to write any files. It is supposed to be read-only as per MSDN: File Access/Permissions in Windows Store Apps:

    The app’s install directory is a read-only location. You can’t gain access to the install directory through the file picker.

    You should be using either the Local, Roaming, or Temporary storage locations.

    See this link: MSDN: Quickstart Local Application Data

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw this in someone's code and thought wow, that's an elegant way to
EDIT: WOW. This question is 12 years old now. As someone stated, it can
Wow I've been struggling with this for whole day, following the official ruby on
Alright, I'll try to explain this the best I can. I have an iPhone
The following code works in Windows 7 x86, but not x64. What's the difference
Wow, this seems so basic, but I can't get it to work. All I
Wow...I've never seen this before. Any way to get around it? foreach( double r
Oh wow is this one annoying me. Using c#, winforms, visual studio 2010 ulti.
Wow, what a mess. This is the scenario. Backbone driven JS app. RequireJS for
// Edit: oh wow. It's odd that I've been working on this for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.