title: System.Unauthorizedaccesexception while reading and writing an xml using Windows 8 xaml C#
body: <p>I am working on windows 8 xaml C# apps, I am trying to read a song xml and append new node to it. The code is:</p>
  
  <pre><code>StorageFolder sf;
  sf = KnownFolders.MusicLibrary;
  StorageFile file = await sf.GetFileAsync(strSongName);
  var item = await file.OpenAsync(FileAccessMode.Read);
  IRandomAccessStream raStream;
  IOutputStream outputStream;
  DataWriter writer;
  var lc = ApplicationData.Current.LocalFolder;
  var infolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
  
  StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(infolder.Path);
  StorageFile file1 = await folder.GetFileAsync("songxml.xml");
  var filetest = await file1.OpenAsync(FileAccessMode.Read);
  Stream inStream = filetest.AsStreamForRead();
  XDocument xdoc = XDocument.Load(inStream);
  string content = xdoc.ToString();
  raStream = await file1.OpenAsync(FileAccessMode.ReadWriteUnsafe);
  outputStream = raStream.GetOutputStreamAt(0);
  writer = new DataWriter(outputStream);
  StringBuilder outputText = new StringBuilder();
  outputText.Append(content.ToString());
  </code></pre>
  
  <p>I get a System.Unauthorizedaccessexception while running this code</p>