How to GZip on ASP.NET and GoDaddy

Referring to the article “Best Practices for Speeding Up Your Web Site” from YUI, Gzip compression reduces the response time. Gzip compression generally reduces the response size by about 70% and approximate 90% of today’s internet traffic travels through browsers. After searching around for answer on how to implement gzip compression on ASP.NET application, I found the solution below is the easiest to implement.

Add the configuration shown below in the in web.config file. This configuration setup enable gzip compression on static and on dynamic content. I have tried it on GoDaddy’s Windows Shared Hosting and it works fine.

Enable Gzip compression in ASP.NET using web.config configuration.

  <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
  <urlCompression doStaticCompression="true" doDynamicCompression="true"/>

This implementation is confirmed with Firebug as shown in the snapshot taken below.


I don’t get paid for writing blog posts. Your “Like” is my only motivation, so please “Like” it if you found this information useful. Cheers!!!

Check out what other says about this post by clicking at the title of this post.

About these ads

Tagged: , , , , , , , , , , , , ,

75 thoughts on “How to GZip on ASP.NET and GoDaddy

  1. jeeshenlee August 4, 2010 at 8:52 am

    Give me a “Like” if you found this post useful. Thanks.

  2. David Madden September 3, 2010 at 10:26 pm

    I had to add these extra types to both static and dynamic and then it worked a treat:

    “application/javascript; charset=utf-8″

  3. jeeshenlee September 3, 2010 at 10:47 pm

    @David, glad that you find out about this.I’m not aware about that as the configuration posted works fine on my hosting account at GoDaddy. Thanks for sharing!

    Can you share the name of your hosting provider? GoDaddy? Gator?

    I just did a rough check on this topic and found out why “x-javascript” is different from “javascrip”, it has something to do with the MIME type. Check out the link below.

    Thanks! :)

  4. SJM September 23, 2010 at 12:01 pm

    Nice! Works like a charm.

  5. wam September 23, 2010 at 1:55 pm

    really really nice job

  6. nilesh October 6, 2010 at 9:43 pm

    Thanks, it works nice……!

  7. Johnny October 15, 2010 at 4:17 pm

    This is excellent.

    This alone upgraded my page speed score from 70 to 73 in Page Speed.

  8. Brian Lang November 17, 2010 at 3:55 am

    When I tried this , I got a 500 Internal Server Error.

    I tried creating a web.config file and uploading that with your code in it. Where does your code go exactly?

  9. Brian Lang November 17, 2010 at 5:08 am

    Found the answer. The code you originally posted needs to be wrapped in a tag.

  10. jeeshenlee November 17, 2010 at 11:19 am

    Hello Brian, the code is meant to be added to your existing web.config file. A new web.config file with these code alone won’t works as you need other configurations as well. :)

    Anyway, i’m happy that you found the answer. Thanks for trying it out.

  11. Brian Lang November 17, 2010 at 12:00 pm

    Ah, but I didn’t need any other configuration. This was all that I needed. The way I understand web.config files is that you can override the Server level web.config file with a file in the site’s root directory. GoDaddy most likely has their own server level file. So in this case, all I needed was the full structure of a web.config file and I was good to go.

  12. jeeshenlee November 17, 2010 at 12:17 pm

    Yes, you are right. GoDaddy does have the server level configuration file but you do need your own configuration file as well at the website level. I have just uploaded a default web.config file generated by Visual Studio 2010, you can use it.
    Default Web.Config

    Add the above Gzip compression to the default web.config, you should be good to go. :)


  13. Brian Lang November 18, 2010 at 1:13 am

    Ah. I realize now more of your confusion on why I didn’t need more of a web.config file. All I’m using it for is to handle GZip compression and Expires Headers. I’m actually running a ColdFusion site on GoDaddy. ColdFusion handles my database connections for me, so no connection strings. ColdFusion’s Application.cfm or Application.cfc handles my Login/Authentication (if needed). So the remainder of that web.config file you provided is not relevant for my site.

    I do want to thank you for this post though – it did get me going in the right direction.

  14. jeeshenlee November 18, 2010 at 2:59 pm

    Haha, I see. Anyway, glad that my post helps though. :)

  15. Alex Odago December 2, 2010 at 10:25 pm

    Thanks so much for this bit of code for the web.config file. It works really great and the difference in loading speed and amount of compression is just UNBELIEVABLE. Many many thanks.

  16. 2010 in review by « myNotes January 2, 2011 at 7:27 pm

    [...] How to GZip on ASP.NET and GoDaddy August 2010 15 comments and 2 Likes on 4 [...]

  17. Noel March 2, 2011 at 4:27 am

    Hi i followed the instructions on this post and i can’t get my website enconding to show gzip. Im using the following tool to check encoding type: it still says my page is uncompressed.

    Using firebug i cant find “Encoding” header as shown in the example… any tips?

  18. jeeshenlee March 4, 2011 at 5:06 pm

    Hello Noel,

    On firebug window, open the “Net” tab. Go to “All” tab and open up the page request in the list. Try to hit “Ctrl+F4″ to refresh if you can’t see the last page request. You should see something similar to my snapshot. :)

    I tried to view my website using the link you gave and get “No” for webpage compress as well. I have no idea how the web app test the site. Can you try Yahoo YSlow? I used it as my benchmark wheh I play with gzip compression.


  19. Noel March 7, 2011 at 9:26 pm

    Thanks for your support jeeshenlee,

    I tried your suggestions and can’t get it to work.
    I have access to the hosting server ( i selected compression options from IIS), and still cant get css/js/aspx gzipped. This is very frustrating, is there any programatic solution (.net server side)?

  20. Noel March 8, 2011 at 3:24 am

    I managed to get aspx pages compression working, however, i still can’t get to compress .js and .css (i have static and dynamic compression enabled on IIS 7.5)…

  21. jeeshenlee March 8, 2011 at 10:05 am

    Hello Noel,

    Given your access to the IIS configuration (on hosting server), you should have better access to configure the gzip compression. You may refer to the link below:

    For those who DO NOT have access to the IIS configuration (like me, using shared hosting) can use the suggested web.config setup to enable gzip compression.

    Good luck. Cheers.

    Jeeshen Lee

  22. jeeshenlee March 8, 2011 at 10:07 am

    Hello Noel,

    Can you try the “types” suggested by on of this post’s commenter (David Madden, second commenter from the top)?

  23. Noel March 9, 2011 at 12:00 am

    I already have dynamic and static compression enabled on iis 7.5 as i mentioned before, i tried david’s suggestion without luck… I guess this has something to do with the URL rewritter module im using, im investigating about this, anything else please let me know. Thanks

  24. Shankar April 15, 2011 at 8:18 pm


    Many thanks for the suggestion but my pages are not getting compressed. I am also using the Windows shared hosting in Godaddy and in my hosting path I have created two folders 1. ZipLipBinary & 2. temp and mapped the same to my web.config file like below

    Please let me know whether I have missed anything. Thanks in advance.


  25. jeeshenlee April 16, 2011 at 11:35 am

    Hello Shankar,

    You may paste the above code in the root of your folder and have your default.aspx execute from the root. I guess that will help.


  26. Rod May 5, 2011 at 12:38 pm


    I’ve searched FAR and wide for this solution.. haven’t tried it yet, but I’m not planning on using .net, I have asp and access all over my site. If I use this on a .net enabled server as well as asp, will it compress the asp files as well? I’m assuming it will since you’re using coldfusion and another guy mentioned php.. ?

  27. jeeshenlee May 5, 2011 at 12:52 pm

    Hello Rod, which version of IIS your hosting server is using?

  28. Rod May 5, 2011 at 1:11 pm

    Wow, Thanks for the quick response.

    IIS 6.0

    Eagerly awaiting your reply :)

  29. jeeshenlee May 5, 2011 at 1:16 pm

    Hello Rod, the code above are meant for IIS 7.

    For IIS 6, you may refer to:

    Hope that helps. ;) Good luck

  30. Rod May 5, 2011 at 1:21 pm

    That would help tremendously if my hosting company would install it on their server but they refuse to do it… hence me trying to find some work around.. ah, well.. I tried. Any other solution you can think of?

  31. jeeshenlee May 5, 2011 at 1:38 pm

    Hello Rod, I would suggest you to do some research on ISS 6 Web Config. In particular, the compatible config setting for “httpcompression”.

    Found this link below that shows ‘httpcompression’ related setting in ISS 6.


  32. Rod May 5, 2011 at 2:31 pm

    Thank you!

  33. [...] on Godday Window Shared Hosting. Refer the web.config configurations needed in this link – August 1, 2010 7:35 [...]

  34. bennytjia June 10, 2011 at 3:50 am

    JS, thanks for this useful post! I am currently working on a blog post too and it is about javascript optimization and I will make sure to put a link to your post here. I think everyone has to see it. It worked perfectly on the godaddy shared account. the gzip is able to cut down jQuery library code size to almost 30kb…it is amazing

  35. jeeshenlee June 10, 2011 at 9:04 am

    @bennytija, sure. ;)

  36. Vladimir Gavriljuk July 7, 2011 at 9:25 pm

    I have a problem… i inserted this code in right place, in my web.config are others settings, but they don’t affects to this code, isn’t it?
    So when i inserted code, i tried in IE9 my website.. but i can’t see changes with code or within it code….
    please help to me…

  37. jeeshenlee July 7, 2011 at 10:20 pm

    Hello Vladimir, yes to code won’t affect other configuration. Did you tried using Firebug to see the changes in the server response?

  38. Vladimir Gavriljuk July 8, 2011 at 1:43 pm

    HEllo, jeeshenlee
    mmm, no, i used included IE toll for web-developers.
    but where i can see responses in firebug?

  39. Vladimir Gavriljuk July 8, 2011 at 3:02 pm

    thanks for help :) all works right :)

  40. jeeshenlee July 8, 2011 at 4:40 pm

    @Vladimir, awesome! ;)

  41. Wahab Kotwal July 17, 2011 at 2:37 am

    i tried ur technique but its giving 500 internal server error.. i have godaddy shared hosting for here the link of my site

  42. jeeshenlee July 17, 2011 at 9:37 am

    @Wahab Kotwal, just checked your site. It’s working, with gzip response too. ;)

  43. Eduard July 23, 2011 at 12:31 am

    Nice article, good job my friend, this article was great for me, cause i use godaddy

  44. Andy August 5, 2011 at 9:35 pm

    Do you have any idea why this works on my local Windos 7 machine, but not on the production server Windows Server 2008 R2? I have enabled dynamic content compression both places.

  45. Akshay Kalia September 18, 2011 at 3:26 pm


    I have a GoDaddy Shared windows account and i tried this but when i am checking it on FireBug, it is still showing it as not GZipped.. and how can I check whether my JS or CSS are being compressed.


  46. jeeshenlee September 23, 2011 at 11:17 am

    You can check it using Firebug. Double check your web.config file especially the httpCompression node.

    Check also the comment from @David Madden suggesting to
    “application/javascript; charset=utf-8″

    for Javascript file. Thanks.

  47. JM November 9, 2011 at 5:32 am

    I had been researching this topic and came across your site. I happen to run my pages at Godaddy. The web.config code worked like a charm. The difference in speed is amazing.

    thank you very much!

  48. ....$விக்னேஷ் December 2, 2011 at 7:23 pm

    nice stuff. thanks

  49. Rondy February 23, 2012 at 4:19 pm

    Thanks so much for posting. Worked for me also.
    Very disappointed in GoDaddy shared hosting for Windows. I can’t believe that they treat these server configuration options as “code” and just leave you stranded.

  50. çelik kasa March 18, 2012 at 7:14 am

    thanks so much. i use tme my site.

  51. amrut June 17, 2012 at 2:01 am

    not working for me..

  52. v'jay June 19, 2012 at 2:19 pm


    I have referred as steps provided by you and below link and successfully implemented Gzip, by compressing aspx pages.

    My website is ajax enabled. One of page is having gridview.

    While debugging gridview rowCommand fires and records are displaying in debugging mode, but same records are not displaying on web page controls.

    Can any1 help me out from this issue?

    Thanks and BRegards,

  53. jeeshenlee June 19, 2012 at 2:40 pm

    @Vijay, try turn on firebug and look at the http. I think the problem you are experiencing has nothing to do with the compression.

  54. v'jay June 19, 2012 at 3:42 pm

    Hi jeeshenlee,

    i have added below code for gzip as per link

    protected override void OnPreRender(EventArgs e)


    by using above code it compresses the aspx page as shown by firebug,

    gridview is getting populated
    clicking on gridview rowcommand fires
    records are displayed in debug mode
    but records are not displaying on web controls like textBox

    After removing above code, records are visible both in debug mode as well as on web controls, but pages are not compressed.

    Does ajax updatepanel is causing it?

  55. jeeshenlee June 19, 2012 at 3:48 pm

    @Vijay, can you PM me the link to your website? would love to take a look.

  56. vjay June 20, 2012 at 12:35 am

    hi jeeshenlee,

    have tried various browser..

    google chrome: working smoothly
    firefox: problem as mentioned
    ie: problem as mentioned

  57. Space August 14, 2012 at 5:17 pm

    Hi, I know it’s been 2 months since the last post but…

    After getting this to work, my @font-face broke for IE, Firefox, and Opera, but not Chrome. I checked in firebug and my .tff and .woff are 404ing. I think it has something to do with mimetypes but I know woefully little about that.

    The main reason I decided to look into gzipping was to cut down the FOUT. Can I modify this method, perhaps adding a new <add mimeType so that my font files will also be gzipped and display properly?

  58. silentjets September 9, 2012 at 2:04 pm

    Thank you for posting this help me a lot.

  59. merhan September 18, 2012 at 5:51 pm

    Hi. I copied your code in my web.config but if you check my wite with firebug, you see that it don’t work,
    I use arvixe share hosting.
    what can I do now? can I reffer to gzip.dll in my bin folder?

  60. Gichan October 3, 2012 at 1:54 am

    Great. Working perfect. Thanks…

  61. Aagust kk October 14, 2012 at 2:46 am

    Hi there! i’m using Godaddy’s Web Deluxe Windows hosting service. And i want to implement Gzip compression, though above you mentioned is not working for me.

    Here is the URL:

    Lastly,Can you please also shed some light on implement Add Expires headers (css,js,html,image).


  62. Matt Jensen October 15, 2012 at 12:07 pm

    Hi there

    This is very useful (it’s probably even worth you stating somewhere that this is not just specific to GoDaddy – it should work on any hosting).

    I have a question for you. Does this method *only* gzip content if the requesting browser sends headers to say that it accepts gzip’d content, or does it gzip content for *every* request?

    Thanks again

  63. Roosevelt Briddell December 18, 2012 at 2:57 pm

    Oh my goodness! Impressive article dude! Many thanks, However I am going through difficulties with your RSS. I don’t know the reason why I am unable to join it. Is there anybody else getting the same RSS problems? Anyone who knows the solution will you kindly respond? Thanks!!

  64. jeeshenlee December 18, 2012 at 3:18 pm

    here’s xml rss feed link

  65. Sachin December 31, 2012 at 3:43 pm

    I need to do the gzip compression for IIS 6.0….please help :)

  66. Mara February 8, 2013 at 1:01 am

    There was no native web.config file for our site, so I copied and pasted the above code into a new xml file and added it to the file manager on godaddy…but the site then gave a 500 internal error immediately after. Is there a reason this would happen? I’ve since deleted the file since we can’t afford for the whole thing to be down like that, but I’m wondering if there’s something I’ve missed in the code, or if there’s any other way to do this. Any feedback would be much appreciated!

  67. jeeshenlee February 8, 2013 at 9:15 am

    @Mara, are your web run on IIS? and is it a ASP.NET website? If yes, you should be able to find the web.config. And the code above are part of the web.config file, you can find the complete standard web.config file here

  68. Jason March 20, 2013 at 11:26 pm

    Thanks! this worked like a charm for my godaddy instance.

  69. Go To My Site May 1, 2013 at 7:37 pm

    Simply want to say your article is as astonishing.
    The clearness in your post is just excellent and i could assume you’re an expert on this subject. Fine with your permission let me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the gratifying work.

  70. […] How to GZip on ASP.NET and GoDaddy […]

  71. Danny June 29, 2013 at 6:01 am

    thank you very much.
    It worked for me too on
    You are the best

  72. Ben Swayne October 10, 2013 at 5:27 am

    Ironically the entire httpCompression configuration element shown is being ignored. The only part of this post that is activating compression is the urlCompression configuration element. httpCompression can only be configured at the applicationHost.config level to apply to the whole server. The configuration shown here for that element happens to be the default which will already be in place on GoDaddy. So yah, you only need one line from this post FYI.

  73. diego November 16, 2013 at 8:23 am

    hi everybody, well i used that code but i can not see the effect with page speed of google, i am proving with out publish, is it because i am in localserver? or what? my server is ISS

  74. Simon November 19, 2013 at 6:03 am

    Great post! I added this to my web.config (including addition by @David Madden):

    But I don’t see the gzip compression in my response headers in firebug:

    What am I missing?

    btw: I’m not on GoDaddy, but have my own virtual private server and access to .

  75. managed wordpress hosting December 10, 2013 at 2:24 am

    What you published was actually very logical.

    But, think on this, suppose you added a little content?
    I mean, I don’t wish to tell you how to run your blog, but what
    if you added a title that grabbed folk’s attention?
    I mean How to GZip on ASP.NET and GoDaddy | JeeShen Lee 李毅胜
    is a little boring. You ought to peek at Yahoo’s front page and note how they write post headlines to grab viewers interested.
    You might try adding a video or a pic or two to grab people excited about everything’ve got
    to say. In my opinion, it could bring your posts a little bit more

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 110 other followers

%d bloggers like this: