Tuesday, September 18, 2012

Download as xml attachment using c#

Response.Clear();
Response.ContentType =
"application/xml";
Response.AppendHeader(
"Content-Disposition", "attachment;filename=" + strFileName + ".xml");Response.AppendHeader(
"Content-Length", strXML.Length.ToString());Response.Write(strXML.ToString());
xmlWriter.Close();

HttpContext.Current.ApplicationInstance.CompleteRequest();

No comments: