午前中ずっと ASP.NET の問題が発生していましたが、これで新しい問題が発生しました
string filepath = "";
filepath = Server.MapPath(Request.QueryString["fileDownloadable"]);
if (filepath != null)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=MyPDF.pdf");
Response.WriteFile(filepath);
Response.ContentType = "";
Response.End();
}
18行目にエラーが表示さResponse.WriteFile(filepath);
れ、パスへのアクセスが拒否されたと表示されます....なぜこれを行うのですか?
はこのRequest.QueryString["fileDownloadable"]
コードから来ています...
<li><a href="./DownloadableProducts.aspx?fileDownloadable=/downloadableProducts/MyPDF.pdf" runat="server">IPC Client Personal Financial Website Feb 12</a></li>
フォルダーのアクセス許可を確認したところ、ルートにある他のすべてのフォルダーと同じ種類のアクセス許可があります。
何か提案はありますか?
ファイルが存在するかどうかを確認するために、コードビハインドの間にこのコードを実行しました..
if(File.Exists(filepath)){
}
エラーなしでページを実行しましたが、ページが機能していませんでした。これは、ファイルパスが存在しないことを示しています。