i have this .xml file read and display at runtime by vb.net2003. the .xml file is the database which contain various data and its not for adding more data or edited by user so i need to protect the file so that my code can read and display those data. can anyone know how to protect the file. If encrypted can i decrypt it inside my program code and display them as needed.

I would be very grateful if anyone could help me on this.

Zela

Hi,

To prevent other users from accessing the file when you open the file set the FileShare mode to None. Since you did not post any code I am not sure what method you are using to open and update the file. A sample using the would be:

File.Open("C:\temp\Filename.xml",FileMode.Append,FileAccess.ReadWrite,FileShare.None);

Found only C# code as an example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.