Can I use encrypt web.config with a custom protection provider who's assembly is not in the GAC?

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-05-20T09:19:28Z Indexed on 2010/05/20 9:20 UTC
Read the original article Hit count: 226

Filed under:
|
|
|
|

I have written a custom protected configuration provider for my web.config.

When I try to encrypt my web.config with it I get the following error from aspnet_iisreg

aspnet_regiis.exe -pef appSettings . -prov CustomProvider (This is running in my MSBuild)

Could not load file or assembly 'MyCustomProviderNamespace' or one of its dependencies. The system cannot find the file specified.

After checking with the Fusion log, I confirm it is checking both the GAC, and 'C:/WINNT/Microsoft.NET/Framework/v2.0.50727/' (the location of aspnet_iisreg). But it cannot find the provider.

I do not want to move my component into the GAC, I want to leave the custom assembly in my ApplicationBase to copy around to various servers without having to pull/push from the GAC.

Here is my provider configuration in the web.config.

<configProtectedData>
  <providers>
    <add name="CustomProvider"
         type="MyCustomProviderNamespace.MyCustomProviderClass,
         MyCustomProviderNamespace" />
  </providers>
</configProtectedData>

Has anyone got any ideas?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about web.config