-1

I am just wondering

why did asp.net team choose / as the default value of Membership Role application name rather than the project name that makes sense?

In addition, the application might not be deployed as the root application. It means that / is no longer appropriate.

Edit 1:

For example: I create a project A first and deploy it. Later I create another project B and deploy it. If both projects use the default, they still work but it will be difficult to know which users come from each project.

For me, it is better if the default is set to the project name.

Edit 2:

I am talking about the applicationName attribute generated by Visual Studio in Web.config. Why don't use the project name instead of / by default ?

<membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider"
             connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>
    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider"
             type="System.Web.Profile.SqlProfileProvider"
             connectionStringName="ApplicationServices"
             applicationName="/" />
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider"
             type="System.Web.Security.SqlRoleProvider"
             connectionStringName="ApplicationServices"
             applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider"
             type="System.Web.Security.WindowsTokenRoleProvider"
             applicationName="/" />
      </providers>

</roleManager>

EDIT 3:

After creating two applications (i.e., one as the root and the other one as the child app) and both have the same applicationName set to /, both application use the same ApplicationID. It means the slash has nothing to do with site domain tree. My confusion has been answered. So... why did Visual Studio set it to / (that makes confusion for me) by default?

EDIT 4:

I have two applications. One as the root application and the other one as the sub application under the former. Both use applicationName = "/". I got the result as follow in database: So what is the meaning of /? If no meaning, why did VS choose this confusing name rather than the project name?

alt text

EDIT 5:

From this article, I will make the summary:

  1. If we remove applicationName attribute from web.config for both applications, the ApplicationName generated in database for the root will be "/" and the ApplicationName generated in database for the sub app will be "/subappvirtualdir".
  2. If we leave the applicationName to its default value of "/" for both applications, both root app and sub app will get the same ApplicatonName of "/" generated in database.
  3. If we change the applicationName to "any name you want" for both applications, the ApplicationName generated in database will be set to "any name you want" for both applications.

Thanks Rockin for the link above !

Second Person Shooter
  • 14,188
  • 21
  • 90
  • 165
  • 1
    when you build a large app, your DBA will set the name when he/she creates the database, and you will build the project. Your database doesn't inherently know what project it's being plugged into. If it's a big enough concern, change the name immediately after creating the database. Again, remember that even thought you "can" create the DB in VS, doesn't always mean you "should" since it can be done independently via aspnet_regsql.exe – Chase Florell Dec 20 '10 at 05:53
  • @rockin, do you know what is the meaning of / as the applicationName? Since I noticed it has nothing to do with the site domain structure. – Second Person Shooter Dec 20 '10 at 07:21
  • But when I create another application under the root application with the same web.config as the root application, I noticed both applications will be given the same ApplciationId in database. So what is the meaning of / ? Thank you. – Second Person Shooter Dec 20 '10 at 07:26
  • I think this question has crossed into "subjective and argumentative" territory. – Andrew Barber Dec 20 '10 at 07:26
  • @Andrew, maybe so if my understanding about / is wrong. – Second Person Shooter Dec 20 '10 at 07:28
  • @xport - you are asking "why did X do Y" when X is not here to answer, and you are arguing every point brought up to explain. You can edit the value to be whatever you want. Just edit it, and don't spend too much time worrying otherwise. – Andrew Barber Dec 20 '10 at 07:31
  • @Andrew, I am worrying this because I don't know what the meaning of / actually is. This slash looks like a path but it does not work as a path. It is my confusion. Thank you. – Second Person Shooter Dec 20 '10 at 07:43

2 Answers2

2

I'd say that the default name is / because your DB is not supposed to know anything about your app. Therefore it doesn't know the project name. They have to have some sort of starting point, and since they're not mind readers, you get a /.

Remember, since you can use Aspnet_regsql.exe to create your ASP.NET Membership Scheme in your database completely independent from Visual Studio, the database can't just "fix" the application name all on it's own. You can of course edit the app name in the database immediately after creating the db, then it doesn't matter anymore.

EDIT

I see in your edit that you're talking about the applicationName in the web.config, and not the one in the database. Please read this blog article (not mine) for some more insights
http://dotnettipoftheday.org/tips/applicationName_attribute.aspx

Chase Florell
  • 46,378
  • 57
  • 186
  • 376
2

An application does not generally know or care what 'project' it came from. So that context likely would not be present.

And if your app isn't at the root, then rename it...

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123