2011-05-25 62 views
0

我想在asp.net配置中爲我的web應用程序設置應用程序名稱,但是沒有任何內容適用於我。它總是說「應用程序:/」。我花了好幾個小時尋找答案。我相信這很簡單(因爲它總是)。有人可以幫忙指出嗎?asp.net配置不顯示我的應用程序名稱

這裏是我的web.config ...

<configuration> 
<connectionStrings> 
    <clear /> 
    <add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AbetEvaluation.mdf;Integrated Security=True;User Instance=True" 
providerName="System.Data.SqlClient" /> 
    <add name="AbetConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AbetEvaluation.mdf;Integrated Security=True;User Instance=True" 
providerName="System.Data.SqlClient" /> 
</connectionStrings> 

<system.web> 

    <compilation debug="true" targetFramework="4.0" /> 

    <authentication mode="Forms"> 
     <forms loginUrl="~/Login.aspx" /> 
    </authentication> 

    <authorization> 
     <allow users="*" /> 
    </authorization> 

    <membership defaultProvider="AbetMembershipProvider"> 
     <providers> 
      <clear /> 
      <add 
    name="AbetMembershipProvider" 
    type="System.Web.Security.SqlMembershipProvider" 
    applicationName="/AbetEvaluation" 
    connectionStringName="AbetConnectionString" 
    requiresQuestionAndAnswer="false" 
    minRequiredPasswordLength="6" 
    minRequiredNonalphanumericCharacters="0" 
    requiresUniqueEmail="true" 
    passwordFormat="Clear" 
    /> 
     </providers> 
    </membership> 

    <roleManager enabled="true" defaultProvider="AbetRoleProvider"> 
     <providers> 
      <clear /> 
      <add 
    name="AbetRoleProvider" 
    type="System.Web.Security.SqlRoleProvider" 
    connectionStringName="AbetConnectionString" 
    applicationName="/AbetEvaluation" 
    /> 
     </providers> 
    </roleManager> 

    <siteMap defaultProvider="XmlSiteMapProvider" enabled="true"> 
     <providers> 
      <add 
    name="XmlSiteMapProvider" 
    description="Default SiteMap provider." 
    type="System.Web.XmlSiteMapProvider" 
    siteMapFile="Web.sitemap" 
    securityTrimmingEnabled="true" 
    /> 
     </providers> 
    </siteMap> 

</system.web> 

+2

愚蠢的問題 - 不顯示它*哪裏*? – blowdart 2011-05-25 01:02:11

+0

當你點擊Project-> ASP.NET Configuration時,它啓動「網站管理工具」並顯示應用程序名稱。我總是顯示「應用程序:/」。而不是「申請:/ AbetEvaluation」。 – Theo 2011-08-16 15:51:47

+0

@Theo那麼答案是什麼? – GoClimbColorado 2012-02-11 18:29:22

回答

3

ASP.NET配置網站,讓ASP.NET成員,角色和配置文件的配置在ApplicationURL查詢字符串參數使用值在網站上顯示。 (即應用程序:/ CoolApp)大多數人只有一個反斜槓字符。您可以通過將項目屬性中的Web應用程序虛擬路徑參數設置爲除/以外的任何內容來更改此設置,無論您將其放置在查詢字符串中。

  1. 務必設定的applicationName在web.config您的角色提供

    添加名稱= 「AspNetSqlRoleProvider」 TYPE = 「System.Web.Security.SqlRoleProvider」 的connectionStringName = 「mySecurityDB」 的applicationName =「/ CoolApp「/>

  2. 更改虛擬路徑:參數項目設置

1

當務之急是要改變的虛擬路徑同樣,提供者元素中的應用程序名稱屬性也不夠。

您可以通過在Visual Studio中打開項目的屬性來更改虛擬路徑,然後選擇左側的Web選項卡。在右窗格中,然後選擇默認未選中的「使用Visual Studio Development Server」單選按鈕,然後纔可以更改虛擬路徑。默認值是「使用本地IIS Web服務器」,因此是/應用程序名稱。

相關問題