I have an urgent issue which is baffling me for a while now and I need to get it resolved. Here is the issue:
I have a ASPNET web application using standard ASPNET tables which I inherited. The application uses ASPNETUSERS table to manage users and everything works fine. I need to add roles to the application. So I added all the standard configuration (shown below).
The issue is all activities when I create a new role is being recorded in ASPNET_USERS and ASPNET_Roles and ASPNETUSERS are invisible to role management. I am trying to avoid moving all the code to ASPNET_USers table (and frankly don't know how). I am not
sure if this is a MVC or WebApp issue. I am using Microsoft.Owin library. Any suggestion or assistance is greatly appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
but registration using the following
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using MyApp.AppCode;
using MyApp.Models;
namespace MayApp.Account
{
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() {
UserName = Email.Text, Email = Email.Text,
FirstName = FirstName.Text, LastName = LastName.Text,
Address = Address.Text, City = City.Text, State = StateDropDownList.SelectedValue, ZipCode = Zip.Text,
PhoneNumber = Phone.Text, AltPhone = AltPhone.Text
};
According to your web.config, I found you use two authorization provider.
Membership and asp.net identity.
This two authorization provider is totally different.
ASP.NET Identity gets away from the membership provider model, which I believe is a good thing. There are some definite problems with Simple Membership when you wanted more advanced security features and if it was anything more
than "simple" you ended up creating your own security solution. In my opinion, I suggest you could choose ASP.NET Identity because it much more extensible than Simple Membership.
I suggest you could migrate from the membership to asp.net identity.
More details about how to migrate membership to identity, I suggest you could refer to below article.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
18 Points
143 Posts
URGENT - ASPNETUSERS and ASPNET_USERS Issue
Apr 22, 2018 01:46 PM|Theguzu|LINK
I have an urgent issue which is baffling me for a while now and I need to get it resolved. Here is the issue:
I have a ASPNET web application using standard ASPNET tables which I inherited. The application uses ASPNETUSERS table to manage users and everything works fine. I need to add roles to the application. So I added all the standard configuration (shown below). The issue is all activities when I create a new role is being recorded in ASPNET_USERS and ASPNET_Roles and ASPNETUSERS are invisible to role management. I am trying to avoid moving all the code to ASPNET_USers table (and frankly don't know how). I am not sure if this is a MVC or WebApp issue. I am using Microsoft.Owin library. Any suggestion or assistance is greatly appreciated.
Here is configuration information.
Role Management using the following classes
but registration using the following
All-Star
53631 Points
23990 Posts
Re: URGENT - ASPNETUSERS and ASPNET_USERS Issue
Apr 22, 2018 04:42 PM|mgebhard|LINK
You are using two completely different Identity APIs; ASP Membership and ASP Identity.
I assume the original app is using ASP Membership as it is the older to the two frameworks then ASP Identity was added?
Anyway, reading the docs should help.
ASP Memberhip
https://msdn.microsoft.com/en-us/library/yh26yfzy.aspx
ASP Identity
https://www.asp.net/identity
Star
9831 Points
3120 Posts
Re: URGENT - ASPNETUSERS and ASPNET_USERS Issue
Apr 23, 2018 07:22 AM|Brando ZWZ|LINK
Hi Theguzu,
According to your web.config, I found you use two authorization provider.
Membership and asp.net identity.
This two authorization provider is totally different.
ASP.NET Identity gets away from the membership provider model, which I believe is a good thing. There are some definite problems with Simple Membership when you wanted more advanced security features and if it was anything more than "simple" you ended up creating your own security solution. In my opinion, I suggest you could choose ASP.NET Identity because it much more extensible than Simple Membership.
I suggest you could migrate from the membership to asp.net identity.
More details about how to migrate membership to identity, I suggest you could refer to below article.
https://docs.microsoft.com/en-us/aspnet/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity
Then you could use asp.net identity role management to achieve your requirement.
More details about how to use asp,net identity, you could refer to below article.
https://www.pluralsight.com/guides/microsoft-net/configuring-asp-net-identity
Best Regards,
Brando