locked
Extending Security Application Block - web.config RRS feed

  • Question

  • User984595800 posted

    Hi,

     I am trying to extend the security application block by creating a class that inherits from AuthorizationProvider. I am pretty much following the directions in the help file. I am using a website project.

    Everything works well when this class is part of an external assembly. However if I add this class to my App_Code folder then I get an exception. Following is the exception:

    The type 'AuthorizationMan1' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.

    Following is the relevant section from my web.config

    <securityConfiguration

    defaultAuthorizationInstance="AM"

    defaultSecurityCacheInstance="Caching Store Provider">

    <authorizationProviders>

    <add name="AM" type="AuthorizationMan1" >

    </add>

    </authorizationProviders>

    </securityConfiguration>

     

    Here is a trivial version of the class:

    [ConfigurationElementType(typeof(CustomAuthorizationProviderData))]
        public class AuthorizationMan1 : AuthorizationProvider
        {
            public AuthorizationMan1(NameValueCollection configurationItems)
            {
    
            }
            public override bool Authorize(IPrincipal principal, string context)
            {
                return true;
    
            }
        }

     Now if I was to have this same class in an assembly called CustomAuth under namespace CustomAuth and change the type in the above web.config to following, then all works fine.

    type="CustomAuth.AuthorizationMan1, CustomAuth"

    So how should I be declaring the 'type' attribute if I wish to have this class in my App_Code folder? My understanding was that assembly name does not need to be included if the class is in the App_Code folder..

     Kunal

    Monday, February 25, 2008 3:27 AM

All replies

  • User-1516799883 posted

    I don't have the answer, but am having a similar question with defining the type= in web.config for the EHAB..  I put the custom classes in their own assembly, installed it in the GAC and still can't get it to find it.. (I get a similar error as you mentioned)

    Please let me know what you find if you get an answer! (mark.peters@dts.ca.gov)

    Thanks.

    Tuesday, April 22, 2008 6:53 PM