Solved

ASP.NET Membership service creating  Applications

Posted on 2013-01-18
11
547 Views
Last Modified: 2013-01-18
I'm using the ASP.NET membership service in my application, but for some reason it creates 2 ApplicationIDs in the Applications table.

I've set the ApplicationName attribute in the web.config, but it still occurs. I have have the correct application name I've defined, and also a default application called '/' that gets created.

Any idea why this happens, as users are created for both, bu the membership table only gets populated with users for the '/' applicationID.
0
Comment
Question by:wint100
  • 6
  • 5
11 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 38794043
Most likely it is from Role Provider or Profile Provider. Check this
0
 
LVL 1

Author Comment

by:wint100
ID: 38794058
Hmm, great info, but I dont have these elements in my web.config at all. I only have the MembershipProvider defined. Do you think this could be the problem?
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38794069
/ may be created from your old setting before you had your new ApplicationName set.

If you create a new user do you see two users being created in aspnet_Users table or just one?

If just one you don't need to worry.

Or you can share your membership provider settings from web.config here.

Or for some reason it could be from conflicting settings from your machine.config.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 1

Author Comment

by:wint100
ID: 38794077
I cleared out the table today and I still get 2 x Applications created and new users are created twice. Annoying thing is that the Membership tabe gets populated with Users from the '/' ApplicationID, but UsersInRole has users from '/MyApplicationName' ApplicationID. The service works well, but if I do alookup on the Users email based on Role, it returns nothing because the UserID for the Role doesn't exist in the Membership table.

<membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" 
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
             connectionStringName="LocalSqlServer" 
      enablePasswordRetrieval="true" 
      enablePasswordReset="true" 
      requiresQuestionAndAnswer="false" 
      applicationName="/MyApplicationName" 
      requiresUniqueEmail="false" 
      passwordFormat="Encrypted" 
      maxInvalidPasswordAttempts="20" 
      minRequiredPasswordLength="4" 
      minRequiredNonalphanumericCharacters="0" 
      passwordAttemptWindow="10" 
      passwordStrengthRegularExpression="" />
      </providers>
    </membership>

Open in new window

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38794090
where is your RolesProvider in web.config or machine.config? Check your machine.config as that's my doubt.

Also try changing the name of the provider and also add defaultProvider attribute to your membership provider

<membership defaultProvider="MyCustomMembershipProvider">
<providers>
        <clear />
        <add name="MyCustomMembershipProvider" ......
0
 
LVL 1

Author Comment

by:wint100
ID: 38794107
It is in the web.config as this gets deployed with my application, I don't touch the machine.config and this happens on my dev machine and production.
0
 
LVL 1

Author Comment

by:wint100
ID: 38794129
Also, there i no mention of my RoldProvider in the web.config, the only mention of roles and permissions is as follows:

<roleManager enabled="true" />
    <authentication mode="Forms">
      <forms name=".MyApplicationName_ASPXAUTH" />
    </authentication>
    <profile>
      <properties>
        <add name="FriendlyName" />
        <add name="PictureURL" />
        <add name="Permissions" />
        <add name="AllowedSites" />
      </properties>
    </profile>

Open in new window

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38794130
If you don't have your RolesProvider defined in your web.config, it is taking up from machine.config. You can define it explicitly in your web.config like in the link I provided earlier.
0
 
LVL 1

Author Comment

by:wint100
ID: 38794141
That's great, I'll test it ASAP. Thanks
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38794158
Oh I missed your other comment with roles provider...so it looks you need to define both Roles and Profile Providers explicitly and set the applicationName as your membershipprovider.
0
 
LVL 1

Author Comment

by:wint100
ID: 38794292
Seems to have worked perfectly, thanks, just need to update my installer and release a new build now.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question