私は次のコードを持っています
try
{
GetFileAndDisplay() // Gets the file from the server and writes the file in a Response stream
}
catch (UnauthorizedAccessException ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg", "<script type='text/javascript'>alert('Error')</script>");
Response.Clear();
Response.ContentType = "";
Response.End();
}
破損したファイルであっても、ファイルはクライアント用にダウンロードされますが、ファイルのダウンロードを停止する方法はあります。