Path access denied when doing "File.WriteAllText"

1

Follow the code below:

public static string pathname = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.ToString()) + @"\Arquivo_Principal";

if (!File.Exists($@"{pathname}\Musica\{nomemusica}.txt"))
{
    File.WriteAllText($@"{pathname}\Musica\{nomemusica}.txt", letramusica, Encoding.UTF8);
}

Any solution?

    
asked by anonymous 26.11.2017 / 15:56

0 answers