Using XML for managing roles

Discussion in 'ASP.NET / ASP.NET Core' started by JRusty15, Jan 20, 2010.

  1. Hello,

    I'm attempting to deploy an asp.net web app. I've done some debugging using localhost and the majority of the app works. The app has three folders, the root, a folder called MemberPages, and a folder called AdminPages. MemberPages and AdminPages are protected and only accessible by users with correct permissions. The is a Login.aspx in the root accessible to all users. Instead of using the SQL version of the role management in ASP.NET I implemented a class that uses XML to manage roles. It works fine using localhost, but when I publish it to my server, I get the following error:

    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Could not load type 'Personal.Providers.XmlProvider'.

    Source Error:

    Line 47: <roleManager enabled="true" defaultProvider="XmlProvider">
    Line 48: <providers>
    Line 49: <add type="Personal.Providers.XmlProvider" name="XmlProvider"/>

    Line 50: </providers>
    Line 51: </roleManager>


    Source File: E:\web\rdmengineer\htdocs\rdmtime\web.config Line: 49

    I'm not quite sure how to deal with this, so I was hoping to get some help from the community here. Thank you.
     
  2. 'Could not load type' indicates a runtime failure of asp.net locating your provider class. It could be:
    1. The assembly that contains the class has not been uploaded or
    2. There is a typo in the web.config providers section
    3. There is a conflict higher up the configuration chain
    Things to try:
    • Put a <clear/> inside the providers element
    • Fully qualify your provider with the <add name="X" type="Namespace.TypeName, Namespace, Version=X.X.X.X, Culture=whatever"/> syntax
     
  3. CrystalCMS, thanks! I've added the <clear/> tag in the providers element before the <add...> tag. I got the same error.

    So I tried to use the fully qualified tag as you had suggested in the following way:

    <add name="XmlProvider" type="Personal.Providers.XmlProvider, System.Configuration.Provider, Version=1.0.0.0, Culture=whatever"/>

    I'm not super sure what to put here, but when I use the line above I get the following error:

    Could not load file or assembly 'System.Configuration.Provider, Version=1.0.0.0, Culture=whatever' or one of its dependencies. The system cannot find the file specified.

    It also had this info at the bottom and I'm not sure what it means:

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


    Any help would be much appreciated. Thanks!
     
  4. The configuration sample you posted is not right. This cannot have worked in development prior to uploading to the server.
    • Take a look at your local machine.config for samples of how to configure the roleManager web.config section. Correctly formed five part fully qualified types are in there.
    • See this for detailed role manager / provider specific information.
    • This might be helpful for more information about 5 part qualified names. It also mentions using the excellent reflector tool.
    • Ensure that whatever you intend to upload does work locally first. ;)
    HTH
     

Share This Page