Web Config Tool - Specified cast is not valid

D

df

I'm seeing a strange problem in the Web App config tool: After
creating a role and a user, going back to the Security tab home page, I
get a "Specified cast is not valid" error.

I've set up my web application to use SQL Server to store the
Membership database using aspnet_regsql.exe and have successfully
opened the Web Config Tool.

Then, I create a role, and go look in the SQL Server aspnet_roles
table, and there is the role. All good.

Now, when I go to the Web Config tool, and create a user, it saves
correctly, and can be seen in the aspnet_users table in the DB, but
when I go back to the Security home page of the Web Config Tool, I get
the above error and can no longer use the tool to manage the users and
roles.

If I delete the Applcation, Membership, User and Role rows from the DB
and go back to the Web App Config tool, everythign is fine.

When I try to create the role and user again, the same thing happens.

The whole error message in the Web Config Tool is:
"
There is a problem with your selected data store. This can be caused
by an invalid server name or credentials, or by insufficient
permission. It can also be caused by the role manager feature not being
enabled. Click the button below to be redirected to a page where you
can choose a new data store.

The following message may help in diagnosing the problem: Specified
cast is not valid.
"

Also, it seems that the same thing happens if I create a User, without
creating a Role first. I have tried running aspnet_regsql.exe again,
but it didn't help.


Ideas?

Dan

Web.Config looks like this:

<system.web>
<authentication mode="Forms" />
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider"
connectionStringName="MyConnection" applicationName="/WebApp"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="true" requiresUniqueEmail="false"
passwordFormat="Hashed" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</providers>
</membership>
<profile enabled="true">
<providers>
<remove name="AspNetSqlProfileProvider"/>
<add name="AspNetSqlProfileProvider"
connectionStringName="MyConnection" applicationName="/WebApp"
type="System.Web.Profile.SqlProfileProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</profile>
<roleManager enabled="true">
<providers>
<remove name="AspNetSqlRoleProvider"/>
<add name="AspNetSqlRoleProvider" connectionStringName="MyConnection"
applicationName="/WebApp" type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
<remove name="AspNetWindowsTokenRoleProvider"/>
<add name="AspNetWindowsTokenRoleProvider" applicationName="/WebApp"
type="System.Web.Security.WindowsTokenRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top