Search code examples
asp.netcompressiongzipwestwind

how do I use wwScriptCompressionModule? for gzip compression with asp.net


Ok, I downloaded the WestWind Ajax Controls, and I added this to my web.config:

<httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="wwScriptCompressionModule" type="Westwind.Web.Controls.wwScriptCompressionModule,Westwind.AjaxToolKit"/>
</httpModules>

I am registering my js like this in my masterpage .cs file:

Page.ClientScript.RegisterClientScriptInclude(typeof(name_of_masterpage), "scripts", ResolveUrl("~/js/all_script.js"));

Now from what I understand, it should be working but it is not? I am likely missing something that is glaringly obvious, but I can't seem to find a simple tutorial or explanation anywhere. I am only using IIS 6.

Thank you very much.


Solution

  • this should work as i think

    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "scripts", ResolveUrl("~/js/all_script.js"));
    

    or another method

    HtmlGenericControl Include = new HtmlGenericControl("script"); 
    Include.Attributes.Add("type", "text/javascript"); 
    Include.Attributes.Add("src", sInclude); 
    this.Page.Header.Controls.Add(Include);
    

    hope this helps