I need to download a file as attachment from my server, I get a string, create xml
document out of it, and then try to download it, nothing happens. Why is that?
string xmlTxt= createdXmlString.Str;
var dir = @"C:\cookieParserXmlOutput\";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlTxt);
var filePath = Path.Combine(dir, "xmlFile.xml");
if(!Directory.Exists(dir))
Directory.CreateDirectory(dir);
doc.Save(filePath);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", $"attachment; filename={"xmlFile.xml"}");
Response.TransmitFile(filePath);
Response.End();
Response.Close();