Archived Forum Post

Index of archived forum posts

Question:

Installing Chilkat .NET on a Web Server for ASP.NET

Mar 15 '13 at 16:13

Hi. My customer has a web site that apparently uses your software. We are willing to buy it for our own web servers, however it looks like it’s a lot more involved than just registering a DLL.

Do we have to go through the steps with Visual Studio, or is there a version of the ChilKat .NET Components that we can just install and be done?


Answer

The Chilkat .NET assembly is a mixed-mode assembly which means internally it contains native code. Many web applications or user accounts are restricted to Medium Trust. However, an assembly that contains native code requires Full Trust to be granted.

I'm not intimately familiar with trust levels in ASP.NET. I'm guessing you can set the trust level at a variety of different places: For an entire website, perhaps for a specific application, or a directory, etc. I do know that it's possible to assign full trust to a particular assembly. Way back in 2006 I wrote this:

Giving Full Trust to a Strong-Named Assembly in a Medium Trust Environment

To modify the medium trust configuration, edit the web_mediumtrust.config file found in the WindowsMicrosoft.NETFrameworkv2.0.****CONFIG directory. At the beginning of the CodeGroup section, insert a CodeGroup fragment for the DLL to be trusted. The DLL is trusted based on the PublicKeyBlob (thus the DLL must be strong-named and signed). The bold text is the text that should be inserted to give ChilkatDotNet2.dll full trust:

(This was for the 2.0/3.5 Framework. I'm sure the similar would apply to the 4.0 or 4.5 Frameworks)

...
    <CodeGroup
        class="FirstMatchCodeGroup"
        version="1"
        PermissionSetName="Nothing">
        <IMembershipCondition
                class="AllMembershipCondition"
                version="1"
        />
        <CodeGroup
            class="UnionCodeGroup"
            version="1″
            PermissionSetName="FullTrust"
            Name="Chilkat_Components"
            Description="This code group grants the ChilkatDotNet2.dll full trust">
            <IMembershipCondition
                    class="StrongNameMembershipCondition"
                    version="1″
                    PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100B535D66DF2C8716055B05EB7F3D332451F89D5A293FC1F9B0244D4EC465FA04AEEC12D5F9731296D95334B311D4015C0567A5CE42475E1192E11798F8463B624FA6E655737207ACAFE2D68F67C2337BAD527BF4D1FB44077845BF93260FC0FFCD0EB30FE7C7290463697F235B71979478BB33DE14B9F73DBAA5402A2767A1ABE"
        />
        </CodeGroup>

    &lt;CodeGroup
            class="UnionCodeGroup"
            version="1″
            PermissionSetName="ASP.Net">
        &lt;IMembershipCondition
                class="UrlMembershipCondition"
                version="1″
                Url="$AppDirUrl$/*"
        />
    &lt;/CodeGroup>