0

エラーメッセージ

"Requested URL: /selva/DDL COMMANDS.doc"

実際、私のファイルパスは

URL:/selva/Docs/DDL COMMANDS.doc

私が使用したコード:

LinkButton lnkbtn = sender as LinkButton;
GridViewRow gvrow = lnkbtn.NamingContainer as GridViewRow;
string filePath = gvDetails.DataKeys[gvrow.RowIndex].Value.ToString();
Response.ContentType = "application/doc";
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filePath + "\"");
Response.TransmitFile(Server.MapPath("~/+ filePath + "));
Response.End();

aspxで

間違いかもしれませんが、誰かがすぐに助けてくれます。前もって感謝します。

4

1 に答える 1

0

これを試して

Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=xxxxxx.doc");
Response.ContentType = "Application/msword";
Response.WriteFile(Server.MapPath("/xxxxxxx.doc"));
Response.Flush();
Response.End();

参照リンク

于 2013-07-25T17:18:09.443 に答える