Anatoly Lubarsky Logo
programming, design, integration, games, music

ASP.NET 2.0: Http Compression and WebResource.axd

Another interesting issue in ASP.NET 2.0. If you use Http Compression module such as blowery, please note that in ASP.NET 2.0 this may cause an issue so all your client script validations and postbacks will stop working. You get various javascript errors like 'WebForm_PostBackOptions' is undefined. It took me several hours to figure out (hope this post will save hundreds of thousands of developers hours world wide).


In ASP.NET 2.0 all validation scripts are processed via server-side WebResource.axd handler while in ASP.NET 1.1 you can find them in aspnet_client folder. Http compression prevents WebResource.axd client side scripts to render normally (or at all ...). Excluding the path=WebResource.axd from the compression configuration solves the problem.


Related Posts:

Saturday, December 3, 2005 9:44 PM

Comments

# re: ASP.NET 2.0: Http Compression and WebResource.axd
So how can we do then ?

3/14/2006 5:30 AM by Mathieu (clertem_a!t_hotmail.com)

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Mathieu: you can exclude the path (WebResource.axd) via web.config.

3/14/2006 5:36 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
How do I exclude the WebResource.axd via web.config?

Is there any other solutions?

3/17/2006 11:07 AM by Arno Janse van Rensburg

# re: ASP.NET 2.0: Http Compression and WebResource.axd
If you don't want to change blowery code, this is the only one that I know...

3/17/2006 11:10 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Arno: see blowery docs/samples how to exclude

3/17/2006 11:11 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
I have found that to copy WebResource.axd to the root of my solution also works. Is this advisable?

3/17/2006 11:18 AM by Arno Janse van Rensburg

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Arno: Interesting. Where do you copy it from ?

3/17/2006 11:31 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
From my temp internet files. My other ASP.Net 2.0 website used it, and it works fine with my problematic web site.

3/17/2006 12:01 PM by Arno Janse van Rensburg

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Arno: Sounds cool. I think it is good solution, I'm going to test it a bit. If it is good as it seems I shall blog about it and give you the credit.

3/17/2006 12:09 PM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Thanks, I will keep my eye on this post for your feedback :)

3/17/2006 12:12 PM by Arno Janse van Rensburg

# re: ASP.NET 2.0: Http Compression and WebResource.axd
No, it doesn't work for me with compression :(

3/17/2006 4:24 PM by Anatoly Lubarsky

# Playing with Webresource.axd

3/18/2006 1:49 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Yes, that might make a difference as I did not enable compression on my website.

3/18/2006 9:14 AM by Arno Janse van Rensburg

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Here is an ASP.NET HTTP Compression Module that WILL compress WebResource.axd requests.

http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=2ccc1da1-e45c-401f-9b58-9b533eadb66b

3/18/2006 7:50 PM by Rich Crane

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Rich: Sounds interesting. But as far as I understand it is not public. How do I get the binaries and the sources ?

3/18/2006 7:54 PM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
You just need to sign into the GotDotNet workspace. It is not unlike going to other sites where you have to login first.

3/19/2006 12:35 AM by Rich Crane

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Rich: Ok, I'm starting to download sources...

3/19/2006 12:43 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
<excludedPaths>
<add path="WebResource.axd"/>
</excludedPaths>

9/16/2006 11:27 AM by jun

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Did anyone try Rich's linked solution? Does it work?

11/4/2006 3:55 AM by John

# re: ASP.NET 2.0: Http Compression and WebResource.axd
I tried it but it didn't work for me - I get the following error - still investigating this. The blowery module didnt work for me no matter what I did - I'm running DNN V4.3.5 and I get 'WebForm_PostBack' problems left and right even with Jun's work around above.

See WinFxCompressionModule Error below (should be simple enough to debug):

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
WinFxProgrammer.WinFxHttpCompression..cctor() +100

[TypeInitializationException: The type initializer for 'WinFxProgrammer.WinFxHttpCompression' threw an exception.]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
System.Web.Configuration.ModulesEntry.Create() +41
System.Web.Configuration.HttpModulesSection.CreateModules() +203
System.Web.HttpApplication.InitModules() +219
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1251
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +317


12/4/2006 1:49 PM by Dave

# re: ASP.NET 2.0: Http Compression and WebResource.axd
I recompiled the dll and redeployed and it works just fine - there was an attribute on the WinFxHttpCompressionModule element in the sample web.config called preferredCompressionLevel - above the comments had correctly referred to it as "maximumCompressionLevel" but hadn't taken notice first time round. Anyways, WebResource.Axd is no longer giving me a headache and my pages are 30-50% smaller than they were before.

12/5/2006 12:25 PM by Dave Rollins

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Dave: I didn't understand. Did you use blowery or something else here ?

12/5/2006 7:48 PM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Where to add the excluded path in web.config file?

2/24/2007 12:11 AM by Jaya

# re: ASP.NET 2.0: Http Compression and WebResource.axd
under "excludedPaths"

2/24/2007 12:14 AM by Anatoly Lubarsky

# re: ASP.NET 2.0: Http Compression and WebResource.axd
Thank you sooo much, you're a life saver!

6/26/2007 4:15 AM by Flatliner DOA

# re: ASP.NET 2.0: Http Compression and WebResource.axd
I do not use blowery, but I'v en error: WebForm_PostBackOptions is undefined. Who help me?

9/5/2007 3:57 PM by Yurets

# re: ASP.NET 2.0: Http Compression and WebResource.axd
How can i enable http compression, can somebody tell me i really want it. And also how smaller are my pages gonan get, en does it compress javascript and html or only html?

4/30/2008 10:52 PM by Thomas

# re: ASP.NET 2.0: Http Compression and WebResource.axd
@Thomas:

it would compress both javascript and html
see blowery component http://www.blowery.org/code/httpcompressionmodule.html
it will help to implement compression

5/1/2008 2:21 AM by Anatoly Lubarsky

Login

Subscribe via RSS

Article Categories

.Net Framework
ASP.NET Tips
C# Win32 API
HTML, CSS, Web
Javascript Tips
MSSQL Tips
System
System.Net
WebServices

Archives

(02) January 2018
(01) June 2013
(03) March 2013
(02) February 2013
(01) July 2012
(01) April 2012
(01) September 2011
(01) August 2011
(03) May 2011
(01) December 2010
(01) November 2010
(01) October 2010
(01) June 2010
(01) May 2010
(02) March 2010
(01) January 2010
(02) December 2009
(03) September 2009
(03) August 2009
(09) July 2009
(04) June 2009
(03) May 2009
(02) April 2009
(03) March 2009
(02) February 2009
(02) January 2009
(04) December 2008
(04) November 2008
(05) October 2008
(04) September 2008
(05) August 2008
(04) July 2008
(05) June 2008
(07) May 2008
(04) April 2008
(03) March 2008
(02) February 2008
(03) January 2008
(03) December 2007
(05) November 2007
(04) October 2007
(05) September 2007
(12) August 2007
(11) July 2007
(14) June 2007
(13) May 2007
(13) April 2007
(10) March 2007
(11) February 2007
(14) January 2007
(14) December 2006
(12) November 2006
(08) October 2006
(09) September 2006
(06) August 2006
(08) July 2006
(10) June 2006
(09) May 2006
(22) April 2006
(25) March 2006
(12) February 2006
(14) January 2006
(19) December 2005
(17) November 2005
(16) October 2005
(16) September 2005
(12) August 2005
(14) July 2005
(09) June 2005
(12) May 2005
(12) April 2005
(20) March 2005
(11) February 2005
(12) January 2005
(18) December 2004
(13) November 2004
(12) October 2004
(14) September 2004
(09) August 2004
(23) July 2004
(19) June 2004
(29) May 2004
(19) April 2004
(16) March 2004
(09) February 2004
(06) January 2004
(02) December 2003
(01) November 2003

Post Categories

.Net and C#
Android
Antispam
App. Development
Architecture
ASP.NET
Blogging
Deprecated Projects
Facebook Platform
Fun
Google
iOS
Javascript
Misc.
MSSQL
Music
My Games
Performance
Roller
Social Networks
Tools
Visual Studio
Web 2.0
WebServices

About Me

linkedin Profile
Recs
Who am I

My Sites

Billy Beet
x2line blogs