When going to Content->Images in Sitefinity admin ELMAH logs an error for every thumbnail displayed.
Error: "System.Web.HttpExceptionServer cannot append header after HTTP headers have been sent."
When going to Content->Images in Sitefinity admin ELMAH logs an error for every thumbnail displayed. If you then go to Administration->Error Log, you can see a new set of errors that are marked with the same time step for what looks like every thumbnail that the page displayed. I have attached the xml of one of these errors. Any ideas what is causing it, and if there is something I should be doing to fix it?
Hello,
I wasn't able to replicate this issue on a website that uses Sitefinity 6.0.4100. We set some headers to the response inside LibraryHttpHandler (SetHeaders method), but I did'n find a place where duplicate header is added. I was using the default storage for images - the database.
We are using file system storage for all our images in Sitefinity 5.4.
This is further information that it is the ELMAH error shows:
System.Web.HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.
at System.Web.HttpResponse.AppendHeader(String name, String value)
at Telerik.Sitefinity.Security.Claims.SitefinityClaimsAuthenticationModule.OnEndRequest(Object sender, EventArgs args)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Hello,
Do you have some other code that ends the response or adds headers upon a request? This error is thrown when you try to add a header after the request has been ended or you try to duplicate the header.
I set a project that uses Sitefinity 5.4.4040. Uploaded several images and the log is still empty. Set Elmah an still the same here.
Have you set AccessControlAllowOrigin property in SecurityConfig? The only header added to this method is when AccessControlAllowOrigin is set
if (!string.IsNullOrWhiteSpace(this.AccessControlAllowOrigin))
application.Context.Response.AddHeader("Access-Control-Allow-Origin", this.AccessControlAllowOrigin);
If you install a new project and upload a single image do you have something in sitefinity's log?
Can you check if there is a difference if you use Sitefinity's project manager to browse the website and if yu host the website in IIS.
Kind regards,
Ivan Dimitrov
the Telerik team
That worked. We did have this value set to "*" and I removed the entry entirely and the error has disappeared from our ELMAH logs
Hi, I think I have the same problem in my app, because its the only sitefinity app we release having this problem.
However, I need this * as we have API calls to the webapp and wanted to allow the cross domain calls, How can it be fixed now ?
I found a fix,
Just removed it from sitefinity security config and added it to the web config as below
<add name="Access-Control-Allow-Headers" value="accept, content-type" />
<add name="Access-Control-Allow-Methods" value="OPTIONS,POST,PUT,DELETE,GET" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>