-1
ダウンロード機能のステージングでは正常に動作しています(IIS 7.5のnasサーバー)。 IE、Edge、Chromeではダウンロードが開始されますが、最後まで届かず、分後にエラーが発生します。 オンラインで多くのドキュメントがあることは知っていますが、私は結果なしで多くのソリューションを試しました。私を助けてください。ダウンロードファイルはFirefox上で動作し、他のブラウザでは動作しません
@Page Language="VB" ContentType="text/html"
@Import Namespace="System.Data"
@Import Namespace="System.Data.SqlClient"
@Import Namespace="System.IO"
Private SUB SDataBind()
'Path construction
Dim VarFileName as string = "mytest.zip"
'Path construction
Dim VarPath as string = "/public/mydownload" & VarFileName
'Absolute path
Dim VarCompletPath as string = Server.MapPath(VarPath)
VarCompletPath = replace(VarCompletPath,"/","\")
'Filename construction
Dim VarLast4Char as string = right(VarFileName,4)
Dim VarNewFilename as string = "download" & VarLast4Char
'Headers cleaner
Response.Clear
Response.ClearHeaders
Response.ClearContent
'Send the file to the browser
Response.AddHeader("Content-Disposition", ("attachment;filename=" & VarNewFilename))
Response.ContentType = ReturnFiletype( right(VarFileName,4) )
Response.WriteFile(VarCompletPath)
Response.Flush()
Response.Close()
Response.End
end sub
'----------------------------
'Get content file type
Private function ReturnFiletype(fileExtension as string) as string
Select Case fileExtension
case ".zip"
return "application/zip"
case ".pdf"
return "application/pdf"
case else
return "application/octet-stream"
end select
end function
"*と分後、*エラーが出る" - どのようなエラー? –
操作がキャンセルされました – paolo