Advertisement Jump to content
Sign in to follow this  

[.net] How to make an xml file writeable

This topic is 4104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an xml file which is readable and writeable. I wnat to ensure that this file is writeable if it is set to read-only. I am doing my work using the code: afpXmlDocumnet As XmlDocument = New XmlDocument afpXmlDocumnet.Load(filename) 'reading some nodes ............................ 'writing to some node ............................ 'saving the file afpXmlDocumnet.Save(appPath) the last line number ,whrere I save xml file, throws an exception when file is read-only. What should I do to avoid this ? How to make it writeable? Any help...

Share this post

Link to post
Share on other sites

I tried with this piece of code before writing to the file :

Dim fileInformation As New FileInfo(filename)
If fileInformation.IsReadOnly Then
fileInformation.Attributes = FileAttributes.Normal
End If

Now it works ...

thanks u ToohrVyk..

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!