Configuration

Declare StaticResourceManager on a web page:

<shinkansen:StaticResourceManager runat="server" 
           HttpCompressWith="GZip" Crunch="true" Combine="true" ScriptPlacement="Bottom">
    <JavaScript>
        <shinkansen:JavaScriptInclude Path="~/assets/js/jquery-1.3.2.min.js" />
        <shinkansen:JavaScriptInclude Path="assets/js/sifr.js" />
        <shinkansen:JavaScriptInclude Path="/assets/js/styleswitcher.js" />
    </JavaScript>
    <Css>
        <shinkansen:CssInclude Path="/assets/css/reset.css" />
        <shinkansen:CssInclude Path="assets/css/sifr.css" />
        <shinkansen:CssInclude Path="~/assets/css/sIFR-print.css" />
    </Css>
</shinkansen:StaticResourceManager>

Add the following entries to web.config:

Register the shinkansen server control prefix (just for convenience of reference)

<pages ...>
    <controls>
        <add tagPrefix="shinkansen" namespace="Shinkansen.Web.UI.WebControls" assembly="Shinkansen" />
    </controls>
</pages>
Register Shinkansen.axd under <httpHandlers> for IIS6:

<httpHandlers>
    <add verb="GET" 
             path="Shinkansen.axd" 
             type="Shinkansen.Runtime.StaticResourceHandler, Shinkansen" validate="false" />
</httpHandlers>
Register Shinkansen.axd under <handlers> for IIS7:

<system.webServer>
    <handlers>
        <add name="Shinkansen" 
                  verb="GET" 
                  path="Shinkansen.axd" 
                  type="Shinkansen.Runtime.StaticResourceHandler, Shinkansen" 
                  preCondition="integratedMode" />
    </handlers>
</system.webServer>
Last, but not least, create <machineKey> for your web.config:

<machineKey
    validationKey="[... generated randomly ...]"
    decryptionKey="[... generated randomly ...]"
    validation="SHA1"
    decryption="AES"
/>
<machineKey> is a very important section. If you don't have one yet, feel free to use my online <machineKey> Generator.

NOTE: By default, Shinkansen uses <machineKey> for encryption. You can write and wire up your own cryptographic key provider (see below).

Standard and custom JavaScript/CSS crunchers

Out of the box, Shinkansen comes with the following crunchers:

The sample web project shows you how to write and wire up a custom cruncher which utilizes Google's Closure Compiler. See global.asax.cs and GoogleJsCruncher.cs.

Standard and custom cryptographic provider

As indicated before, Shinkansen relies on the <machinKey> section of web.cofig for its key/initialization vector pair. The sample web project shows you how to write and wire up a custom cryptographic provider. See global.asax.cs and CustomCryptoKeyProvider.cs.

A note about partial trust

Normally, a hosting company will run your site in partial trust. This implies a number of limitations, described in great detail here: How To: Use Medium Trust in ASP.NET 2.0.

Shinkansen is designed to work in partial trust. The sample Google JavaScript cruncher needs full trust. Just be aware of this issue.

If you can run your site in full trust---great! you have nothing to worry about.
Last edited Mar 10 at 9:35 PM by MilanNegovan, version 6
Comments
No comments yet.

Updating...
© 2006-2010 Microsoft | Get Help | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2010.2.24.16331