applicationname =“/”即使明确指定了吗?

时间:2011-01-07 19:10:16

标签: asp.net-membership profile

当我的页面config.aspx加载时,会创建一个与当前用户关联的配置文件条目 - 这很正常。 但是,即使我明确指定applicationname =“MyTool”,aspname_applications表中的applicationname字段设置为'/'

所以我猜我还有另一个应该设置应用程序名的地方 - 到目前为止我有:

<add name="SqlProvider" 
     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
     connectionStringName="MyToolConnection" 
     enablePasswordRetrieval="false" 
     enablePasswordReset="true" 
     requiresQuestionAndAnswer="false" 
     applicationName="/MyTool"              <-- I tried both "MyTool" and "/MyTool"
     requiresUniqueEmail="true" 
     minRequiredPasswordLength="7" 
     minRequiredNonalphanumericCharacters="0" 
     passwordFormat="Hashed" 
     maxInvalidPasswordAttempts="5" 
     passwordAttemptWindow="10" 
     passwordStrengthRegularExpression="" />


 <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider" >
      <providers>
        <clear />
        <add connectionStringName="MyToolConnection" applicationName="/MyTool" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
        <add applicationName="/MyTool" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
    </roleManager>




 <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Application Name=/MyTool;Data Source=.\SQLEXPRESS;Initial Catalog=MyTool;Integrated Security=True" providerName="System.Data.SqlClient" />
    <add name="MyToolConnection" connectionString="Application Name=/MyTool;Data Source=.\SQLEXPRESS;Initial Catalog=MyTool;Integrated Security=True" providerName="System.Data.SqlClient" /> 
  </connectionStrings>

1 个答案:

答案 0 :(得分:0)

您在问题中提到了“个人资料”。

您是否还在web.config的<profile>元素中设置应用程序名称?

<profile enabled="true" defaultProvider="SqlServices">
<providers>
<clear/>
<add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlServices" applicationName="MyTool" />
</providers>