Access to path "C:\Program Files\...\myfile.xml" is denied

warrent

Member
Joined
Nov 19, 2005
Messages
12
Programming Experience
3-5
I've created a deployment. I'm getting an error when trying to write to an xml file. Everything works on my computer. I installed the program onto another computer and i get this error.

Access to path "C:\Program Files\...\myfile.xml" is denied

When I created the deployment, I included the xml file and made it a hidden file. I am able to read from it, but not write to it. I've installed the lastest .net framework. Not sure what else to do. Is there some permissions I'm missing?
 
And the code I'm using to access the xml file is:

AppExe = Application.StartupPath

xmlfile = New System.Xml.XmlDocument

xmlfile.Load(AppExe & "\myfile.xml")

xmlfilenodelist = xmlfile.SelectNodes("/location")

Dim xmlfilenode As System.Xml.XmlNode
For Each xmlfilenode In xmlfilenodelist
.
.
.
.
Next

Could the "Application.StartupPath" be causing problems
 
Do you mean that you can write to a hidden xml with your development machine but not at another machine, or is it just for deployment you hide the file?
 
when i add the xml file to the deployment, I chose to make it hidden from the properties window.

After it is deployed, I then installed the program onto my PC and everything seemed to work fine. I then installed the program on another PC and I get he error msg.

I figured that hidding the xml file would not allow the user to see the file, but could it also not allow access to the file?
 
I think I figured it out.
I am able to write to the xml files now.
Making the xml files hidden seems to prevent the user from writing to the files.
 
Back
Top