Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 6th, 2005, 02:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default Same file or changed?

Currently, I am playing around with a web service, which - on request - reads a file and sends back an object representing the contents of the file.

The consumer-side recieves the object and possibly make changes to it and post it back, where it is stored/updated in the same file.

However, I want some mechanism, which check if it is actually the same file as when it was requested in the first place. Some other person might have changed it while it was being edited. If that is the case it should not be updated, but the user should be made aware of the fault.

I have thought about several options, but I not sure what the best practice is. Here is what I though...

- Checksum, calculate when requested send it together with the object and check when the changes are submitted. I do not want to implement all kinds of algorithms, so what are my options i C#, if this is the best way?

- Reading the file properties and instead of sending the checksum with the object, then send the time it was last changed. Is this a possible solution?

Thanks a lot, Jacob.
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).
Reply With Quote
  #2 (permalink)  
Old July 8th, 2005, 08:50 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I would think that a timestamp would be sufficient. Like you described, have the web service reply with the file contents along with the timestamp on the file. Send the timestamp back when you call the service with a file update. Compare and verify the timestamps match to catch a concurrency disruption.

-Peter
Reply With Quote
  #3 (permalink)  
Old July 8th, 2005, 09:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter, that's going to be the solution, and I guess also the easiest to implement ;) .

Jacob.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can the mousepointer be changed? apike VBScript 0 April 17th, 2007 10:38 PM
export excel file ( format is changed ) urgent palanivel jayanthi ASP.NET 1.0 and 1.1 Professional 1 March 12th, 2007 05:32 PM
export excel file ( format is changed ) urgent palanivel jayanthi ASP.NET 1.0 and 1.1 Basics 1 March 12th, 2007 05:31 PM
web config file format changed sarah lee ASP.NET 1.0 and 1.1 Basics 0 September 29th, 2006 01:31 PM
Getting CHANGED value from Datagrid? Ron Howerton Pro VB.NET 2002/2003 5 January 5th, 2005 02:11 PM



All times are GMT -4. The time now is 08:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.