asp.Netファイルダウンロード時にファイル内容を出力

629 ワード

 
  
<br>protected void Page_Load(object sender, System.EventArgs e) <br>{ <br>Response.ContentType = "application/x-shockwave-flash"; <br>string fileFlash = Server.MapPath("/") + "1.swf"; <br>System.IO.FileStream fileStream = new System.IO.FileStream(fileFlash, System.IO.FileMode.Open); <br>byte[] buffer = new byte[fileStream.Length]; <br>fileStream.Read(buffer,0,(int)fileStream.Length); <br>Response.BinaryWrite(buffer); <br>} <br>