Search code examples
asp.netmembershipsqlmembershipprovider

asp.net configuration doesn't show my application name


I want to set the application name for my web app in the asp.net configuration, but nothing is working for me. It always says "Application:/". I have put quite a few hours into searching for an answer. I'm sure it's something simple (as it always is). Can someone help point it out?

Here's my 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>


Solution

  • The ASP.NET Configuration website that allows configuration of ASP.NET Membership, Role and Profiles uses the value in the ApplicationURL query string parameter to display on the website. (ie. Application: /CoolApp) Most people with have only a backslash character. You can change this by setting the web applications Virtual Path parameter in the project properties to something other than /, whatever you put there will be used in the query string.

    1. Always set the applicationName in the web.config for your role providers

      add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="mySecurityDB" applicationName="/CoolApp"/>

    2. Change the Virtual path: parameter in your project settings