Hi All,
How to download XML data from byte array in Asp.net core. Below is my code
string sXML = xml data in string format
byte[] bytesInStream = System.Text.Encoding.UTF8.GetBytes(sXML);
Please let me know whats the code for download in .net core MVC. The code working in .net framework MVC giving compile error. that code giving below
byte[] bytesInStream = System.Text.Encoding.UTF8.GetBytes(sXML);
string fileName = FileName
Response.Clear();
Response.ContentType = "text/xml";
Response.AddHeader("content-disposition", $"attachment; filename={fileName}");
Response.BinaryWrite(bytesInStream);
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.End();