-1
我嘗試從serverside下載docx文件。 我的錯誤是什麼?爲什麼不能在asp.net中打開下載的docx文件?
這是代碼:
FileInfo file = new FileInfo(filepath);
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AppendHeader("Content-Disposition", "attachment; filename = " + ((Button)sender).CommandName + ".docx");
Response.AppendHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.Flush();
Response.Close();
Response.End();
你得到了什麼錯誤? – Marcus 2012-07-24 21:48:30
這是一個正常的asp.net文件,您使用的瀏覽器是?它發生在不同的瀏覽器上嗎? – Graymatter 2012-07-24 21:59:27
我下載了它,但它並沒有在辦公室打開,而我使用chrome – Mennan 2012-07-24 22:03:58