0

I have an app that was developed back in 2013 that was developed in Visual Studio 2010, using WebForms and System.Web.Security.Membership for security.

Personally, I would like to just use it the way it is, since it seems to still work just fine. However our company has decided that due to security concerns, we can no longer use the 'dbo.' schema in the database.

So, I made a bunch of changes in the database for new schemas and adding the tables to those schemas.

But, there is still one problem that is driving me crazy.

Microsoft, in its infinite wisdom decided that if you use System.Web.Security.Membership in your app, it will automatically create several tables in the database and put them in the 'dbo.' schema, whether you want them there or not.

So, I understand that the new replacement for Membership is Identity, and that supposedly, if you use Identity, you can set it up to use whatever schema you want it to.

Thing is, that when I Google (sometimes Google is NOT your friend), I come up with a lot of examples, but they all seem to be using MVC instead of WebForms, or they want to use ASP.NET Core. So the examples want controllers, etc.

How do I go about letting the Identity code in the app know that it is supposed to use the "SECURITY" schema and not dbo?


OK, so, I have read those 2 sites and I was able to add identity to the app.

However, as far as changing the schema for the tables, everything that I have found says to go into the class that inherits from DbContext and add the method: protected override void OnModelCreating(DbModelBuilder modelBuilder)

Then I would use something like: modelBuilder.Entity<User>().ToTable("AspNetUsers", "SECURITY");

To change the schema.

So, I try that and my first problem is that there is no class inheriting DbContext in my whole solution. Also, there is no method OnModelCreating for me to override.

I am getting totally lost with this. I inherited the code after all of the people that worked on it left, so I cannot ask them anything about it.

  • Security concern over `dbo.` schema? not concern over outdated hashing methods in MembershipProvider? – trailmax Dec 14 '17 at 12:05
  • Default Identity implementation is based on EntityFramework and this is how you change the schema in EF: https://stackoverflow.com/a/9563108/809357 – trailmax Dec 14 '17 at 12:06
  • And this is how you do webforms with identity https://learn.microsoft.com/en-us/aspnet/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project – trailmax Dec 14 '17 at 12:06
  • OK, so, I have read those 2 sites and I was able to add identity to the app. However, as far as changing the schema for the tables, everything that I have found says to go into the class that inherits from DbContext and add the method: `protected override void OnModelCreating(DbModelBuilder modelBuilder)` – Bob Mathis Dec 19 '17 at 17:30

0 Answers0