questo l'ho appena provato. Scarico un file tif e verifico la lunghezza 30.269.440 byte e funziona benissimo
codice:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim messaggioErrore As String = ""
Dim filePath As String = "C:\dati\ProveNikon\3.tif"
Dim fi As FileInfo = New FileInfo(filePath)
If Not fi.Exists Then
messaggioErrore = "file non esistente"
End If
' imposta le headers
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=""" & fi.Name & """")
Response.AddHeader("Content-Length", fi.Length.ToString())
Response.ContentType = "application/octet-stream"
' leggo dal file e scrivo nello stream di risposta
Response.WriteFile(filePath)
Response.End()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>