2011-01-07 52 views
0

當我的頁面config.aspx加載時,一個配置文件條目與當前用戶關聯創建 - 這工作正常。 但是,即使我明確指定applicationname =「MyTool」,applicationname字段在aspnet_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> 

回答

0

你在你的問題中提到「配置文件」。

您是否還在web.config的<profile>元素中設置應用程序名稱?

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