Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1027979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:18:59+00:00 2026-05-16T12:18:59+00:00

I have a web form, that needs to save the data that the user

  • 0

I have a web form, that needs to save the data that the user enters, into a file and on the client pc, that will also be able to read from the saved file and repopulate the fields at a later time. No files will be saved to the server side, so I expect streaming needs to be involved at writing time.

I decided XML would be an easy way to do this, but I’m stymied on methodology. XML documents? XML Writers? I’m stumped on the right search terms to even get what I want.

Thanks in advance for any pointers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:18:59+00:00Added an answer on May 16, 2026 at 12:18 pm

    You’ll want to use XML serialization. Take a look at this [MSDN article][1]. Here’s an excerpt on serialization and deserialization:

    How to Serialize an Object

    To Serialize and object, we need few
    instances of the in-built classes. So
    lets first create an instance of a
    XmlDocument class from System.Xml
    namespace. Then create an instance of
    XmlSerializer class from
    System.Xml.Serialization namespace
    with parameter as the object type. Now
    just create an instance of the
    MemoryStream class from System.IO
    namespace that is going to help us to
    hold the serialized data. So all your
    instances are there, now you need to
    call their methods and get your
    serialzed object in the xml format. My
    function to Serialize an object looks
    like following.

    private string SerializeAnObject(object obj)
    
    {
    
        System.Xml.XmlDocument doc = new XmlDocument();
    
        System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
    
        System.IO.MemoryStream stream = new System.IO.MemoryStream();
    
        try
    
        {
    
            serializer.Serialize(stream, obj);
    
            stream.Position = 0;
    
            doc.Load(stream);
    
            return doc.InnerXml;
    
        }
    
        catch
    
        {
    
            throw;
    
        }
    
        finally
    
        {
    
            stream.Close();
    
            stream.Dispose();
    
        }
    
    }
    

    How to DeSerialize an Object

    To DeSerialize an object you need an
    instance of StringReader, XmlReader
    and XmlSerializer class in order to
    read the xml data (Serialized data),
    read it into XmlReader and DeSerialize
    it respectively. So in brief my
    function to DeSerialize the object
    looks like following.

    private object DeSerializeAnObject(string xmlOfAnObject)
    
    {
    
        MyClass myObject = new MyClass();
    
        System.IO.StringReader read = new StringReader(xmlOfAnObject);
    
        System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(myObject.GetType());
    
        System.Xml.XmlReader reader = new XmlTextReader(read);
    
        try
    
        {
    
            myObject = (MyClass)serializer.Deserialize(reader);
    
            return myObject;
    
        }
    
        catch
    
        {
    
        throw;
    
        }
    
        finally
    
        {
    
            reader.Close();
    
            read.Close();
    
            read.Dispose();
    
        }
    
    }
    
    
    
      [1]: https://msdn.microsoft.com/en-us/library/182eeyhh%28v=VS.90%29.aspx
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.