gfa = new Module_Command.GetFileAttach(this.supportFileID, "2");
Attach = gfa.Execute();
gfa.UnExecute();
if (Attach != null)
{
dtOneFile = (DataTable)Attach;
filePath = "course/"
+ dtOneFile.Rows[0]["CourseID"].ToString()
+"/"
+ dtOneFile.Rows[0]["HomeWorkID"].ToString()
+"/attachment/"
+ dtOneFile.Rows[0]["SupportFileName"].ToString();
filename = dtOneFile.Rows[0]["SupportFileName"].ToString();
filename = filename.Replace(" ", "%20");
//if (context.Request.Browser.Browser == "IE")
userAgent = context.Request.Headers.Get("User-Agent");
if (userAgent.Contains("MSIE 7.0"))
filename = context.Server.UrlPathEncode(dtOneFile.Rows[0]["SupportFileName"].ToString());
context.Response.ContentType = "application/download";
context.Response.AddHeader("Content-Disposition", "attachment;filename=" + filename + ";");
ASP.NET 如何設定強制下載檔案並正確處理中文檔名的問題
【茶包射手專欄】Cassini's Response Header Encoding
沒有留言:
張貼留言
留個話吧:)