473,396 Members | 2,076 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,396 software developers and data experts.

File Upload/Download Problem

I am building an ASP.NET application that has a requirement that the
user should be able to download all of the data that they have input
into the system and save it to a file on their local PC. Then at some
future time they should be able to upload it back to the web server and
continue working on it. (Don't ask me why they have to be able to do
this. Apparently the users are super paranoid about saving their data
to the server and want to be able to keep it on their local PC)

Anyway, here is my problem. I am not sure the best way to handle this.
I have a class structure where the root class is called UserCase.
UserCase holds all of their information, including other classes for
sub information including collections, etc. My original plan was to
use XMLSerialization to serialize UserCase to an XML file and then have
the user download the file to their PC. Then, later they could upload
that XML file back to the server and I could use de-serialization to
change it back to a UserCase object and they would be good to go.
However this has brought up a ton of related problems like the
following:

1. All of my classes inherit from XPBaseObject which is a 3rd party
component from DevExpress (www.devexpress.com) called Express
Persistent Objects. XPO is an object/relation mapper that hides the
database and makes coding a lot simpler. The problem is that
XPBaseObject does not support serialization. So I have had to take a
stab at implementing the IXMLSerializable interface myself. So far
that has been a nightmare.
2. How should the system handle it when changes are made to the web
site and a user uploads an old XML file that doesn't fit the structure?
3. How do I handle data integrity issues if data on the server changes
and the XML file is not in synch with the server?
4. Is there any good way to automate the upload/download process that I
described above? Or is there any way to make it easier?

Basically I am looking for some advice for a better way to solve the
above scenario. I have a web app where the user needs to be able to
download their data to their PC and then re-upload it at a future time.
It needs to be fairly secure and fairly simple for the user to do. It
also needs to be able to handle data integrity issues, file corruption
issues, etc. Any help or advice would be greatly appreciated.

Thanks,
Corey

Jan 19 '06 #1
1 2226
I would make a duplicate class (I will call it a DTO-Data Transfer
Object) that does nothing but hold the data. I would then add a
constructor to your real object accepting the DTO and have the
constructor build the object using the input data.

When structural changes are made, the new version becomes a new DTO. The
object gets a new constructor for the new version. Now the object can
handle building itself from two different versions of the uploaded data.

This means of course your upload routine will have to be smart enough to
figure out which version of the object was uploaded before de-
serialization. I would recommend a version number property on the DTO to
simplify this. It does not need to be in your real object. Simple
XMLReader code can get the version number before de-serialization.

--
----
700cb Development, Inc.
http://www.700cb.net
..NET utilities, developer tools,
and enterprise solutions

th*********@yahoo.com wrote in news:1137688863.705024.211810
@f14g2000cwb.googlegroups.com:
I am building an ASP.NET application that has a requirement that the
user should be able to download all of the data that they have input
into the system and save it to a file on their local PC. Then at some
future time they should be able to upload it back to the web server and
continue working on it. (Don't ask me why they have to be able to do
this. Apparently the users are super paranoid about saving their data
to the server and want to be able to keep it on their local PC)

Anyway, here is my problem. I am not sure the best way to handle this.
I have a class structure where the root class is called UserCase.
UserCase holds all of their information, including other classes for
sub information including collections, etc. My original plan was to
use XMLSerialization to serialize UserCase to an XML file and then have
the user download the file to their PC. Then, later they could upload
that XML file back to the server and I could use de-serialization to
change it back to a UserCase object and they would be good to go.
However this has brought up a ton of related problems like the
following:

1. All of my classes inherit from XPBaseObject which is a 3rd party
component from DevExpress (www.devexpress.com) called Express
Persistent Objects. XPO is an object/relation mapper that hides the
database and makes coding a lot simpler. The problem is that
XPBaseObject does not support serialization. So I have had to take a
stab at implementing the IXMLSerializable interface myself. So far
that has been a nightmare.
2. How should the system handle it when changes are made to the web
site and a user uploads an old XML file that doesn't fit the structure?
3. How do I handle data integrity issues if data on the server changes
and the XML file is not in synch with the server?
4. Is there any good way to automate the upload/download process that I
described above? Or is there any way to make it easier?

Basically I am looking for some advice for a better way to solve the
above scenario. I have a web app where the user needs to be able to
download their data to their PC and then re-upload it at a future time.
It needs to be fairly secure and fairly simple for the user to do. It
also needs to be able to handle data integrity issues, file corruption
issues, etc. Any help or advice would be greatly appreciated.

Thanks,
Corey


Mar 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
by: wakun | last post by:
Hi there, I am using a POST method to upload a big file (20M), I have already set the max-upload-file = 30M in php.ini and have the hidden MAX_FILE_SIZE=30M in multipart form. However, it still...
4
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
4
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
2
by: fReDiNi | last post by:
Hi, I have being trying fo find the best solution for this problem for 2 days now and I am not able to find a solution.I need help. I explain the problem: A customer needs a system so that...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
6
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= | last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an error: Could not find file 'C:\testfile.xls'. If I add the file (c:\testfile.xls) to the server I do not get the error...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.