本文介绍了使用提示从SQL blob保存到客户端计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ASP.NET网络应用程序和一个从SQL BLOB检索到一个字节[]的文件。
假设我有一个名为myData的byte []中的数据。
byte [] myData = MyDataToBeSaved;
我需要将此文件保存到客户端计算机。保存浏览器时应提示保存文件的位置。
Hi,
I have a ASP.NET web-application and a file retrieved from SQL BLOB into a byte[].
Suppose I have the data in a byte[] called myData.
byte[] myData= MyDataToBeSaved;
I need to save this file to the client machine. While saving the browser should prompt the location where to save the file.
推荐答案
Response.Clear();
Response.AddHeader("Cache-Control", "no-cache, must-revalidate, post-check=0, pre-check=0");
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Content-Description", "File Download");
Response.AddHeader("Content-Type", "application/force-download");
Response.AddHeader("Content-Transfer-Encoding", "binary\n");
Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
Response.BinaryWrite(data);
Response.End();
这篇关于使用提示从SQL blob保存到客户端计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!