this.Response.ClearHeaders();
this.Response.Clear();
this.Response.Buffer=false;
System.Data.OleDb.OleDbConnection odc=new OleDbConnection();
odc.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+this.Server.MapPath("MyDB\\") +
System.Configuration.ConfigurationSettings.AppSettings["connstr"];
OleDbDataReader dr;
OleDbCommand odcd=new OleDbCommand("Select * From [Code] Where CodeID="+this.Request.QueryString["id"],odc);
odc.Open();
dr=odcd.ExecuteReader();
if(!dr.Read())
this.Response.Redirect(""); string filename=dr["filename"].ToString();
byte[] by;
by=(byte[])dr["file2"];// this.Response.Write(filename);
odc.Close();
this.Response.AddHeader("Content-Disposition","attachment;filename="+System.Web.HttpUtility.UrlEncode(filename));
this.Response.AddHeader("Content-Length",by.Length.ToString());
this.Response.ContentType="application/octet-stream";
this.Response.BinaryWrite(by);
this.Response.End();
this.Response.Clear();
this.Response.Buffer=false;
System.Data.OleDb.OleDbConnection odc=new OleDbConnection();
odc.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+this.Server.MapPath("MyDB\\") +
System.Configuration.ConfigurationSettings.AppSettings["connstr"];
OleDbDataReader dr;
OleDbCommand odcd=new OleDbCommand("Select * From [Code] Where CodeID="+this.Request.QueryString["id"],odc);
odc.Open();
dr=odcd.ExecuteReader();
if(!dr.Read())
this.Response.Redirect(""); string filename=dr["filename"].ToString();
byte[] by;
by=(byte[])dr["file2"];// this.Response.Write(filename);
odc.Close();
this.Response.AddHeader("Content-Disposition","attachment;filename="+System.Web.HttpUtility.UrlEncode(filename));
this.Response.AddHeader("Content-Length",by.Length.ToString());
this.Response.ContentType="application/octet-stream";
this.Response.BinaryWrite(by);
this.Response.End();
我想问以前的不用C#,是怎么做的?
http://www.yesky.com/20020910/1629570.shtml(中文)
http://expert.csdn.net/Expert/topic/1200/1200373.xml?temp=.8520014(可断点续传)
--------------------------------------------------
Response.Clear
Response.Buffer = true
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition","attachment;filename=<文件名>"
Response.BinaryWrite ts.ReadAll//要下载的数据
Response.Flush
Response.End
----------------------------------------------------