473,395 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Make an xml file writeable

38
In a windows application 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:



Expand|Select|Wrap|Line Numbers
  1. Dim afpXmlDocumnet As XmlDocument = New XmlDocument
  2. afpXmlDocumnet.Load(filename)
  3.  
  4. 'reading some nodes
  5. ............................
  6.  
  7. 'writing to some node
  8. ............................
  9.  
  10. 'saving the file
  11. afpXmlDocumnet.Save(appPath)

the code at line number 11 throws an exception when file is read-only. What should I do to avoid this ? How to make it writeable? Any help...
Oct 27 '07 #1
1 1721
jaleel
38
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 ...
Oct 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian Richmond | last post by:
I'm writing a script to upload images along with articles to a directory on the server. I'm developing it offline on my WinXP and Apache 1.3.x laptop and it's working great, but when I move the...
6
by: no one | last post by:
I need to find a way to upload an Excel file into an MS SQL database using a web control front end. I have my ASP.Net control (using C#) uploading a file to a directory, but the server people now...
2
by: Tony Hedge | last post by:
Hello, 1.1 .NET running on Windows XP... I have read only files on my local machine. I want to use the above SetAttributes to check OFF the readonly attribute for some of those files because...
0
by: John Clark | last post by:
Hi, I am using webbrowser control to automate a site. this site contains form with tage <INPUT TYPE=FILE ...> I know the control is not writeable. So, only thing that I could do was: ...
1
by: lawrence k | last post by:
I'm trying to write some RSS feeds. I've created a folder called rss, and it lives in the same directory as my scripts. I run the script and get no result. I put in a is_writeable() check and it...
0
by: hazz | last post by:
using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, "Select Column_Name,Include_in_Report From ColumnsToSelect")) { this.GridViewColumns.DataSource = dataReader;...
4
by: robinsand | last post by:
Header File: car.h #if !defined CAR_H #define CAR_H enum TCarType { ctEconomy = 1, ctCompact, ctStandard, ctFullSize, ctMiniVan, ctSUV }; class Car { public: Car();
6
by: Peter | last post by:
Greetings, I'm having trouble deciding on whether to go with a flat file or DB driven architecture for a wee personal website. I'd like to be able to update HTML files online and this is my only...
2
by: amittewarii | last post by:
Hello Everybody , I need help in parsing the given file , ################################################################# <sample_cfg : 00FF_F000> #f_name ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.