答5:
private void delwenjian(string filename)
//filename为要下载文件的路径及相应路径下的文件名
{
FileInfo fi=new FileInfo(filename);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(fi.FullName,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length",fi.Length.ToString());
Response.WriteFile(fi.FullName);
Response.Flush();
System.IO.File.Delete(filename);
Response.End();
}
删除服务器端的文件的话就用
System.IO.File.Delete(filename);就可以了
=========================================
来自:http://www.nqqn.com/ym/185/121626.htm