WebControls.Login.MembershipProvider

0 views
Skip to first unread message

Steven Nagy

unread,
Sep 17, 2006, 5:24:43 PM9/17/06
to
Hidey ho,

C#, ASP.NET, VS2005, SQL Server 2005 Developer

I've used aspnet_regsql to install the membership/role tables into my
application database.
I have confirmed that all the tables are there.
I've also configured the web.config to specify the new database as the
role provider and the membership provider. I have used the "ASP.NET
Configuration" tool to manage users and roles. These are definately
saved to the database mentioned above. All this works great.

I have added a WebControls.Login control to the form and, by default,
the username/password is not accepted (even though the custom
membership provider is specified as default in the web.config). I
changed the property of "MembershipProvider" for the control and
specified my custom membership provider. Still no love.

To trouble shoot, I handled the "LoginError" event of the Login control
and discovered that it doesn't think the username exists which makes me
think its still not talking to the correct database. I DO have SQL
Express installed on the same machine, along with SQL Server 2000 as
well.

Here's my web.config entries for my providers:

<roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="DBCS" />
</providers>
</roleManager>

<membership defaultProvider="CustomizedMembershipProvider">
<providers>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="DBCS"
minRequiredNonalphanumericCharacters="0"
minRequiredPasswordLength="7" />
</providers>
</membership>

Any help is appreciated!

Thanks,
Steven

Steven Nagy

unread,
Sep 18, 2006, 4:37:55 AM9/18/06
to
I fixed this problem. For those interested:

The user that got created was being inserted with an "Application" name
of "\myapp" however by default, the web config entry for the membership
provider assumes an application name of "\" so it was querying the
database asking for a user of "steven" in the "\" app instead of the
"\myapp". Even though when I went to the ASP.NET Web configuration, I
clicked the radio that specifies one membership profile per application
(instead of one for ALL applications), it still set up the tables as
though it was going to be reused across multiple applications.

So the actual fix was an entry in the web config for the member
provider, specifying the application name, here's an example:

<membership defaultProvider="CustomizedMembershipProvider">
<providers>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"

applicationName="/myApp"
connectionStringName="MyDBC"


minRequiredNonalphanumericCharacters="0"
minRequiredPasswordLength="7" />
</providers>
</membership>


Hope this helps future readers. Don't reply to this if it did, just
send me money.

SN

Sean Chambers

unread,
Sep 18, 2006, 11:41:51 AM9/18/06
to
I've actually banged my head against the wall in the past over this
same problem. Finally I figured out the problem and was cursing the
membership controls.

Steven Nagy

unread,
Sep 18, 2006, 5:18:23 PM9/18/06
to
Its good that it makes sense once you work out the problem.
And I guess its a mistake you will only make once.
But still, its not as intuitive as it could be.

Sean Chambers

unread,
Sep 19, 2006, 11:33:52 AM9/19/06
to
I agree completely, the first time I tried to figure it out it took me
quite awhile.

Oh well.

Reply all
Reply to author
Forward
0 new messages