Reputation: 81
:)
I'm trying to write an XML file in the application folder, however I keep getting the access error denied.
I already have the manifest file with:
requestedExecutionLevel level = "requireAdministrator" uiAccess = "false"
I get the folder path with:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
Can anyone help me? Thank you!
Ps.: Sorry for the the bad english.
-- EDIT This is the part where I try write the file.
try
{
string caminhoXML = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
dsGenAlys.WriteXml(caminhoXML);
}
catch (Exception ex)
{
lbl_status.Text = "Status: Não foi possível salvar. Error: " + ex.Message;
return;
}
I always get the labelmsg text with the Acess Denied to the folder path.
-- EDIT 2
I get this error on any path I put.
Upvotes: 1
Views: 922
Reputation: 494
Your problem is that you are not specifically stating a filename in the xmlWrite path. Append a name for the file and it should work.
Upvotes: 2
Reputation: 81
Solved!
With the comment of @aguertin, "The problem is actually because in your path there isn't a file name", I just use the string with a name for the file. Done!
Thank you all!
Upvotes: 0