how to read and write the xml file in c# and assign to a string

string xmlData = System.IO.File.ReadAllText(@"C:\test.xml");
      System.IO.File.WriteAllText(@"C:\test.xml", xmlData);

Hi Riyas,
as earlier suggested.. you can directly write that xml file into a string and you can print on the webpage.


here textbox1 is a textbox with multiplelines...

protected void Page_Load(object sender, EventArgs e)
    {
        string xmlData = System.IO.File.ReadAllText(@"C:\test.xml");
        System.IO.File.WriteAllText(@"C:\test.xml", xmlData);
        TextBox1.Text = xmlData;
    }

thank you so much for ur advice... were are you from?

I'm from Atlanta, Georgia.

Please mark this thread as solved if your question has been answered and good luck!

hi kameshwari,

were r u from

Hi Riyas,
I am from hyderabad (AP) - India... what abt u??

chennai(TN). when do u come online regularly

hi daily i will browse these forums ... there is no specific time for browsing ...Anyways to day i'm leaving a bit early.....

bye...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.