Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

asp.net - Page displays random symbols instead of error message on Firefox

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

????????I?%&/m?{J?J??t??$@?????iG#)?*??eVe]f@?? ??{???{??;?N'????fdl??J??!????~|?"??Ey?')=??y6????h??????i??- ?ez????7i?i?L???,?4??i????e???|uz????:?}???U{????????????~??u.-?????l>F'?????Y?l??$k?tF??????{?? ??[????'U???|6J?lR??b6??юG?k?^,?????}<~<?;c?R鱕iV??m?|??? ?yDl???tR??|N??>?Ey?裟?k??!z?????Y)5??G??A?8$D????oI??]?P ?"?/??v[????W?~???m`N?rvk???Mqz3???wV?

It happens quite randomly, and seems to be caused by different factors. Here, it's on a file upload.

We use SharpZipLib on this page, but the codepath shouldn't use it.

Does anyone knows why this happens, and how to prevent it ?

EDIT : it only happens on Firefox. IE(8) displays the error message correctly.

EDIT 2 : it seems to happen quite randomly, only on some pages/sites. The same page on another IIS site works well. It seems to do this only on IIS7 ; I have no reports of those on IIS6, and I haven't encountered it on my dev machine.

EDIT 3 : it looks like it happens only when the page crashes.

EDIT 4 : Ok, so, it happens only on IIS7, and only when I get an error 500. I think it might be the IIS error pages that have a problem. How can I try to change them ?

Firebug gives me those headers :

Response
Cache-Control private
Content-Type text/html; charset=utf-8
Server Microsoft-IIS/7.0
X-AspNet-Version 2.0.50727
X-Powered-By ASP.NET
Date Mon, 04 Apr 2011 10:31:24 GMT
Content-Length 2284
Request
Host xxxx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16 ( .NET CLR 3.5.30729; .NET4.0E)
Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Referer xxxxx
Cookie xxxxxx

Is there any way for me to say "on this page, I don't accept gzip compression at all" ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I did not find any real solution, but I found a satisfying workaround.

Keep in mind that the problem only arises under those conditions :

  • The website is configured on IIS7 / Windows Server 2008.
  • The page displaying the garbage symbols has, in reality, crashed. The resulting "garbage" is, in fact, an gzip-compressed error message that has not been decompressed, or something like that.
  • Disabling gzip compression on either dynamic or static content does'nt change anything

The workaround is simple : refuse gzip-compressed content in the browser. In Firefox, as seen in http://forgetmenotes.blogspot.com/2009/05/how-to-disable-gzip-compression-in.html :

  1. Type about:config in the URL bar (Accept the disclaimer)
  2. Type encoding in the filter field underneath the URL bar
  3. Doubleclick the line "network.http.accept-encoding"
  4. Empty the value

On my website, it did some weird things with the CSS (and StackOverflow does not have any CSS at all after that), but at least it correctly showed me the error message, which enabled me to fix the bug.

Hopefully it will help someone.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...