|
如何下載IIS Server上的文件? |
|
|
你可在IIS Server上的檔通過下面的方法使檔進行下載。 FileInfo file = new FileInfo(filePath);//filePath為你在Server上路徑 if (file.Exists) { Response.Clear(); Response.Buffer = false; Response.ContentType = "application/x-msdownload"; Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.Filter.Close(); Response.WriteFile(file.FullName); Response.End(); }
|
|
|