Jump to content
  • Advertisement
Sign in to follow this  
akjal

[.net] How to make an xml file writeable

This topic is 3916 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
Advertisement
Hi

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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!