close
不需要在站台產出暫存檔 可以下載文字檔
StringBuilder sb = new StringBuilder(); string output = "Output"; sb.Append(output); sb.Append("\r\n"); string text = sb.ToString(); Response.Clear(); Response.ClearHeaders(); Response.AppendHeader("Content-Length", text.Length.ToString()); Response.ContentType = "text/plain"; Response.AppendHeader("Content-Disposition", "attachment;filename=\"output.txt\""); Response.Write(text); Response.End();
來源 https://stackoverflow.com/questions/14755339/download-text-as-file-in-asp-net
全站熱搜