Question posted by: Mike P2
(Guest)
on
June 4th, 2007 08:55 PM
Hi. To make page downloading quicker, I added GZipStream into the
Response filter. My (shortened VB) code snippet from Global.asax looks
like this:
............................................
Sub Application_BeginRequest(...)
If Request.RawUrl.Contains(".aspx") And _
Not Request.Headers("Accept-Encoding") Is Nothing Then
If Request.Headers("Accept-
encoding").ToLower().Contains("gzip") Then
Response.Filter = New GZipStream(Response.Filter,
CompressionMode.Compress, True)
Response.AppendHeader("Content-encoding", "gzip")
' Else...try deflate
End If
End If
End Sub
............................................
I added the check for .aspx in the request because it was messing up
images. Now that I'm using AJAX, it's giving me problems again. When
AJAX (I mean ASP's AJAX thing, but I'm not using Atlas) tries to
communicate with the server, it (JS) alert()s me that it could not
parse the server's response, and is probably because of a filter
(meaning this simple GZip stream).
How can I more efficiently check whether or not it is appropriate to
compress the output? And, by the way, is there a better way of
compressing output that won't mess up with images and could possibly
compress AJAX also?
-Mike PII
|
|
June 11th, 2007 09:25 PM
# 4
|
Re: GZip output compression with AJAX
Ok, I tried using
If Request.Headers("Accept").Contains("html") Or
Request.Headers("Accept").Contains("xml")) Then
instead to decide whether or not to compress the output with GZ and my
other filter that takes out some whitespace, but that's not helping
either. I guess ASP.net AJAX is served by the same page it's on
instead of ScriptResource.axd or whatever. So what can I do?
-Mike PII