2012-10-31 2 views
1

일부 ASP.NET 응용 프로그램에서 작업하고 있습니다. 고장 또는 오류가 발생하면 이상한 오류 화면이 표시됩니다. 응용 프로그램은 테스트 단계에 현재 그래서, 내가의 Web.config에서 볼 수있는 오류 화면을 떠난입니다ASP.net 응용 프로그램의 이상한 오류 화면

.... 등등

��`I�%&/m�{J�J��t��`$ؐ@�������iG#)�*��eVe][email protected]�흼��{����{����;�N'���? 
\fdl��J�ɞ!���?~|?"��Ey�')=��y6�����h��贮 
�:�V�˼n��E:��,m�Wy�����<�ӶJ�e;~|W^�`4�u�A:�f��/> 

과 : 오류 페이지가 같은 것을 보여줍니다. 같은 문제에 직면 해 있고 문제와 해결책을 얻은 사람은 누구입니까?

답변

2

작업중인 ASP.NET 응용 프로그램이 자동 GZip 압축을 사용하는지 확인하십시오. 오류 페이지는 Rick Strahl이 여기에 설명하는 내용을 매우 암시합니다 : http://www.west-wind.com/weblog/posts/2011/May/02/ASPNET-GZip-Encoding-Caveats. 또한 블로그 게시물에 해결책이 있습니다. 참조에 대한 솔루션 릭 Strahl, 그리고 앤드류 Sklyarevsky에

+0

네, 맞습니다. HTTP 압축 (GZIP)을 사용하고 있으며 솔루션에도 감사드립니다. 도와 주셔서 정말 고맙습니다. – Cyberpks

2

감사합니다 : D

참조 및 완전한 설명 : 나는 Global.asax에 다음 코드를 추가하고, 문제, 따라서 솔루션을 해결

http://www.west-wind.com/weblog/posts/2011/May/02/ASPNET-GZip-Encoding-Caveats :

protected void Application_Error(object sender, EventArgs e) 
{ 
    // Remove any special filtering especially GZip filtering 
    Response.Filter = null; 
… 
} 

또는 더 나은

protected void Application_PreSendRequestHeaders() 
{ 
// ensure that if GZip/Deflate Encoding is applied that headers are set 
// also works when error occurs if filters are still active 
HttpResponse response = HttpContext.Current.Response; 
if (response.Filter is GZipStream && response.Headers["Content-encoding"] != "gzip") 
    response.AppendHeader("Content-encoding", "gzip"); 
else if (response.Filter is DeflateStream && response.Headers["Content-encoding"] != "deflate") 
    response.AppendHeader("Content-encoding", "deflate"); 
} 
관련 문제