Dimas Longo
Dimas Longo

Reputation: 1217

Could not find stored procedure 'dbo.aspnet_UsersInRoles_GetRolesForUser'

Strange errors are happening after backing up a SQL Server database to another server. The application has also been migrated. It is an ASP.NET MVC4 application.

I get the following error:

Could not find stored procedure 'dbo.aspnet_UsersInRoles_GetRolesForUser'. 

Line 1:  @{
Line 2:      bool visible = false;
Line 3:      if (User.IsInRole("Administrador"))
Line 4:      {
Line 5:          visible = true;

The stored procedure is there, the database is the same, and the server has the same name so I presume the connection string should not be changed.

How can I trace the errors to find what is going on?

Upvotes: 3

Views: 2721

Answers (1)

saille
saille

Reputation: 9191

Check the connection string being used by ASP.NET Membership. This is the connectionStringName attribute in the membership provider section. Then refer to the connectionStrings section to see the actual connection string as per that name.

eg.

<membership defaultProvider="AspNetSqlMembershipProvider">
  <providers>
  <clear/>
  <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider,       System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="THE_CONNECTION_STRING_NAME"  applicationName="/"/>
</providers>
</membership>

Upvotes: 1

Related Questions