asp.net 下载文件时输出文件内容
作者:
asp.net下当下载文件时,读取路径,输出数据。
复制代码 代码如下:
<script language="C#" runat="server">
protected void Page_Load(object sender, System.EventArgs e)
{
Response.ContentType = "application/x-shockwave-flash";
string fileFlash = Server.MapPath("/") + "1.swf";
System.IO.FileStream fileStream = new System.IO.FileStream(fileFlash, System.IO.FileMode.Open);
byte[] buffer = new byte[fileStream.Length];
fileStream.Read(buffer,0,(int)fileStream.Length);
Response.BinaryWrite(buffer);
}
</script>