General Topics include: .NET Framework
Note: Most posts can be categorized into one of the forums below, where experts on that topic will be able to help you find a solution to your problem faster and more efficiently.

Go Back  Xtreme .NET Talk > .NET > General > How to Protect XML file


Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2008, 06:20 AM
surajit_shah surajit_shah is offline
Newcomer
 
Join Date: Jul 2008
Posts: 5
surajit_shah is on a distinguished road
Question How to Protect XML file



I have a windows application in C#.net.In my application there is a xml file which is updated on every 30 seconds by the application automatically.I don't want the external user to update or tamper the xml file.So how can I Protect the xml file so that other users can not read or update the xml file.


Help me.

Thanks in advance.
Reply With Quote
  #2  
Old 08-04-2008, 06:11 PM
roger_wgnr roger_wgnr is offline
Newcomer

Preferred language:
VB.NET
 
Join Date: Mar 2008
Location: San Antonio, TX
Posts: 9
roger_wgnr is on a distinguished road
Default Re: How to Protect XML file

Quote:
Originally Posted by surajit_shah View Post
.So how can I Protect the xml file so that other users can not read or update the xml file..
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
Code:
File.Open("C:\temp\Filename.xml",FileMode.Append,FileAccess.ReadWrite,FileShare.None);
the FileShare can be None which will cause all access by other programs to fail until it is released. You can also set it to Read to allow read only access.
Reply With Quote
  #3  
Old 08-11-2008, 11:18 AM
Nate Bross Nate Bross is offline
Contributor

Preferred language:
CSharp
 
Join Date: Apr 2005
Location: Chicago, IL
Posts: 601
Nate Bross is on a distinguished road
Default Re: How to Protect XML file

Out of curiosity, why do you need to update an XML file every 30 seconds? Do other programs read this XML file, or is it only for use by your application?

I'm just wondering if there might be a better way to achieve your desired result? Even if it's a small file, disk IO every 30 seconds could start to impact system performance.
__________________

~Nate™
___________________________________________
Please use the [vb]/[cs] tags on posted code.
Please post solutions you find somewhere else.
Follow me on Twitter here.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add node to xml file without XML document inter Database / XML / Reporting 2 08-22-2005 07:46 AM
Saving XML data to an XML File from Save As Dialog Kedhrin Database / XML / Reporting 11 07-15-2005 06:40 PM
how to extract info from a xml file follow a extraction rule in a xsl file ? van Database / XML / Reporting 0 11-10-2003 12:10 PM
To all File IO Gurus >> Async XML File Input element Directory / File IO / Registry 1 10-30-2003 01:21 PM
XML Schema from XML file hog Database / XML / Reporting 3 08-21-2003 07:25 AM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe