Page displays random symbols instead of error message on Firefox

后端 未结 4 689
梦毁少年i
梦毁少年i 2020-12-10 03:47

Randomly, on a few projects, some pages display random symbols instead of an error message. Like this one :

��������I�%&/m�{J�J��t��$@�����iG#)�*��e

4条回答
  •  眼角桃花
    2020-12-10 03:58

    This is looks like gZip error decoding.

    Check if you set the Content-Length in a way on your pages, and then use gZip filter. If yes then remove the Content-Length set from your code.

    This can happend when you send the Content-Length and later you compress it and iis can not change the header Content-Length to the new compressed one, and send the wrong size, then browser is reading the wrong size and fail to decompress it correct.

    reference:
    ASP.NET site sometimes freezing up and/or showing odd text at top of the page while loading, on load balanced servers

    Update

    Other possible reason is to set a wronge Response.ContentType, for example to set it as text and you send a gif image, or to set it as image and you send a text.

    Update 2

    Maybe the error is on the the content type. Set this headers:

    context.Response.ContentType = "application/octet-stream";
    context.Response.AppendHeader("Content-disposition", "attachment; filename=" + cFileNameToShowAndDownload);
    

提交回复
热议问题