有没有办法在客户端上创建一个按钮,生成一个text/xml文件,将content-type设置为application-download,添加一个附件等等?我想要的是在我的页面上有一个“下载”按钮,可以保存一个xml文件。这是我在服务器端完成同样任务的方法:
response.StatusCode = 200;
response.ContentEncoding = Encoding.UTF32;
response.AddHeader("content-disposition", "attachment; filename=" + fileName);
response.AddHeader("Content-Transfer-Encoding", "binary");
response.AddHeader("Content-Length", response.ContentEncoding.GetByteCount(xmlString).ToString());
response.ContentType = "application-download";
response.Write(xmlString);