点击 LinkButton1 ,让客户下载文件,能行吗??
点击 LinkButton1 ,让客户下载文件,能行吗??
代码怎样写??
[解决办法]
string name = Server.MapPath( "~/1.ascx ");
FileInfo aFile = new FileInfo(name);
Response.Clear();
Response.ClearHeaders();
Response.BufferOutput = false;
Response.ContentType = "application/octet-stream ";
Response.AppendHeader( "Content-disposition ", "attachment;filename=1.ascx ");
Response.AddHeader( "Content-Length ", aFile.Length.ToString());
Response.WriteFile(name);
Response.Flush();
Response.End();