exporting XML client side

May 26 2009 12:53 AM

hi all,

In my web site i'm creating a XML. Which should be downloaded to the client on client request.

i am writing 

if (targetFile.Exists)
            {
                Response.ClearContent();
                Response.AddHeader("content-disposition", "attachment;filename="fileName.xml");
                Response.AddHeader("content-length", targetFile.Length.ToString());
                Response.ContentType = "application/xml";
                Response.WriteFile(targetFile.FullName);             
            }

 

Server side this code is running fine.

But when  run it on IIS some exception is  coming .... SOme invalid XML tags are being written..... Infact the "Default.aspx" page is being written with the XML................................

can anybody please help me doing this......!!!!!

every thought is appreciated...!!!!


Answers (1)