File Upload/Download Problem

Discussion in 'ASP .Net' started by theburnetts@yahoo.com, Jan 19, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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

    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
    >
    >
    cbDevelopment, Mar 13, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Taylor
    Replies:
    2
    Views:
    925
    Ryan Taylor
    Nov 10, 2004
  2. Sam --
    Replies:
    2
    Views:
    597
    Sam --
    Mar 17, 2005
  3. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,423
    Bruce Barker
    Aug 3, 2005
  4. Heather Fraser
    Replies:
    0
    Views:
    615
    Heather Fraser
    Jul 5, 2004
  5. Brett  Kelly
    Replies:
    1
    Views:
    667
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
Loading...

Share This Page