That's right; "Server cannot append header after http headers have been sent" error message:
The problem is e.g. here: (\Components\FileSystem\FileSystemUtils.vb)
Public Shared Sub DownloadFile(ByVal FileLoc As String)
Dim objFile As New System.IO.FileInfo(FileLoc)
Dim objResponse As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
If objFile.Exists Then
objResponse.ClearContent()
objResponse.ClearHeaders()
objResponse.AppendHeader("content-disposition", "attachment; filename=" + objFile.Name.ToString)
objResponse.AppendHeader("Content-Length", objFile.Length.ToString())
objResponse.ContentType = GetContentType(objFile.Extension.Replace(".", ""))
WriteFile(objFile.FullName)
objResponse.Flush()
objResponse.Close()
End If
End Sub
or any other place where a similar operation is performed e.g.; my custom code:
Private Shared Sub DownloadFile0(ByVal fullFileName As String, ByVal fileHttpContext As System.Web.HttpContext)
Dim myFileInfo As System.IO.FileInfo
myFileInfo = New System.IO.FileInfo(fullFileName)
fileHttpContext.Response.Clear()
fileHttpContext.Response.ClearHeaders()
fileHttpContext.Response.ClearContent()
fileHttpContext.Response.AppendHeader("Content-disposition", "attachment; filename=" & myFileInfo.Name)
fileHttpContext.Response.AppendHeader("Content-Length", myFileInfo.Length.ToString())
fileHttpContext.Response.ContentType = "application/octet-stream"
fileHttpContext.Response.TransmitFile(fullFileName)
fileHttpContext.Response.Flush()
fileHttpContext.Response.Close()
End Sub
ClearContent() and/or ClearHeaders() doesn't help
[HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.]
System.Web.HttpResponse.AppendHeader(String name, String value) +3209294
DotNetNuke.HttpModules.Compression.CompressingFilter.WriteHeaders() +42
DotNetNuke.HttpModules.Compression.GZipFilter.Write(Byte[] buffer, Int32 offset, Int32 count) +18
DotNetNuke.HttpModules.Compression.WhitespaceFilter.Write(Byte[] buffer, Int32 offset, Int32 count) +175
System.Web.HttpWriter.Filter(Boolean finalFiltering) +251
System.Web.HttpResponse.FilterOutput() +60
System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +29
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Does anybody have any clue about how to workaround this issue? or is it a core bug?
Thanks!,
hj.-