尝试从Web.Config中读取角色部分时出错

时间:2010-02-21 19:31:01

标签: asp.net asp.net-membership web-config

执行此行时:

Dim roleRedirectSection As LoginRedirectByRoleSection = DirectCast(ConfigurationManager.GetSection("loginRedirectByRole"), LoginRedirectByRoleSection)

...我收到以下错误:

消息:“为loginRedirectByRole创建配置节处理程序时发生错误:无法加载类型'sitename.LoginRedirectByRoleSection'。(W:\ Webs \ 2010 \ DEV \ sitename \ ASP 4.0 \ web.config第10行)”< / p>

<configuration>
    <configSections>
        <section name="loginRedirectByRole" type="journeyeast.LoginRedirectByRoleSection"   allowLocation="true" allowDefinition="Everywhere" />
    </configSections>
    <loginRedirectByRole>
        <roleRedirects>
            <add role="Administrator" url="~/Account/Admin/Default.aspx" />
            <add role="Employee" url="~/Account/Emp/Default.aspx" />
            <add role="Teacher" url="~/Account/Teacher/Default.aspx" />
            <add role="Student" url="~/Account/Student/Default.aspx" />
            <add role="School" url="~/Account/School/Default.aspx" />
        </roleRedirects>

1 个答案:

答案 0 :(得分:1)

您可能需要指定完整的类型名称,包括journeyeast.LoginRedirectByRoleSection所在的程序集。

type="journeyeast.LoginRedirectByRoleSection, assemblyName"