0

I am working on application using Identity 2.0 and .NET Framework 4.5.1. It is giving me error Invalid object name [dbo.aspnet_SchemaVersions].

Why is it even looking for membership tables?

I searched the net and most says that I should use \v4.0.30319\aspnet_regsql.exe to Configure SQL server application services and when I do that it creates all new stored procedures and tables being used for simple membership.

I strictly want to use Identity 2.0 and do not want to use membership. I have AspNetUsers , AspNetRoles tables in my database but it is expecting other tables like 'dbo.aspnet_SchemaVersions'.

LJNielsenDk
  • 1,414
  • 1
  • 16
  • 32

1 Answers1

0

I narrowed down to the code that is causing it to look for "aspnet_SchemaVersions" table. In _layout.cshtml page, I was trying to show UserAdmin page if the user is an Admin. That was causing the project to look for Membership related tables. I have commented this and droped the membership related tables and it is working fine. Only issue is that now even Admin cannot see UserAdmin Page. This is what I commented in _layout.cshtml

@@if (Request.IsAuthenticated && User.IsInRole("Admin")) {

  • @Html.ActionLink("RolesAdmin", "Index", "RolesAdmin")
  • @Html.ActionLink("UsersAdmin", "Index", "UsersAdmin")
  • }
    @