By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

Web Config Tool - Specified cast is not valid

P: n/a
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>
....

Aug 1 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.