I am trying to get a security demo working by using an AzMan provider, to handle authorization requests to areas of an application.
I have installed Enterprise library 4.1, and have referenced the DLLs from the installed location in c:\Program Files.
When I right-click on the web.config and 'Edit Enterprise library configuration', I add an AzMan Provider to the Security Block and what this does is to put the following line into the web.config (line 4):
<section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null" />
When I try to call
IAuthorizationProvider provider = AuthorizationFactory.GetAuthorizationProvider("AzMan Provider");
it throws an exception:
"An error occurred creating the configuration section handler for securityConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Security, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (c:\Temp\WebApplication1\web.config line 4)"
If I manually edit the web.config and take the PublicKeyToken=null out, then it works. But, the designer puts it back in again whenever I use it to save the web.config so obviously I would like to try to find a better solution i.e. get to the bottom of
what is actually going wrong.
It seems to me like it is trying to load an assembly with a PublicKeyToken of null, when the Microsoft.Practices.EnterpriseLibrary.Security assembly hasn't got a public key token of null, so why is it trying to demand that it be null?
I should also point out that I did also install the source code, and initially referenced the dlls from there. But I suspected conflicts between these DLLs and the installed ones may be an issue, so I removed all reference to these (including deleting
them from 'temporary asp.net files' folder), and referenced the DLLs instead from the installed location in C:\program files, which I gather is the location where the designer runs from... and this doesn't seem to have solved the problem.
Any ideas much appreciated!
Thanks very much