0

I am using asp.net webform 4.5.1. I want to compress the pages with Gzip method. Before in asp.net 2 after adding Gzip's Dll I added this code to Web.config:

<?xml version="1.0"?>
<configuration>
<configSections>
    <sectionGroup name="DCWeb">
        <section name="HttpCompress" type="DC.Web.HttpCompress.Configuration,            DC.Web.HttpCompress"/>
    </sectionGroup>
</configSections>
<DCWeb>
    <HttpCompress compressionType="GZip">
        <IncludedMimeTypes>
            <add mime="text/html"/>
        </IncludedMimeTypes>
        <ExcludedMimeTypes>
            <add mime="image/jpeg"/>
            <add mime="text/javascript"/>
        </ExcludedMimeTypes>
        <ExcludedPaths>
            <!--<add path="~/Default.aspx" />-->
        </ExcludedPaths>
    </HttpCompress>
</DCWeb>
<appSettings>
    <add key="Anthem.ResponseType" value="application/x-anthem"/>
</appSettings>
<system.web>
    <httpModules>
        <add name="HttpCompressModule" type="DC.Web.HttpCompress.HttpModule,DC.Web.HttpCompress"/>
    </httpModules>
    <httpHandlers>
        <add verb="*" path="js.axd,css.axd" type="DC.Web.HttpCompress.CompressionHandler,DC.Web.HttpCompress"/>
    </httpHandlers>

</system.web>

</configuration>

But know I dont know How can I do this in asp.net 4.5.1 . Please Help me. Also I want to know that, is there any other better method to compress the webpage and speed up the page load?

user3125254
  • 219
  • 1
  • 3
  • 6

1 Answers1

0

New iis needs new configuration. The handlers and modules are not defined in <system.webServer>

This should do it I hope:

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <handlers>
    <add name="HttpCompressHandler" verb="*" path="js.axd,css.axd" type="DC.Web.HttpCompress.CompressionHandler,DC.Web.HttpCompress"/>
  </handlers>
  <modules>
    <add name="HttpCompressModule" type="DC.Web.HttpCompress.HttpModule,DC.Web.HttpCompress"/>
  </modules>
</system.webServer>
MichaC
  • 13,104
  • 2
  • 44
  • 56