FAQ Database Discussion Community


Roles.AddUsersToRoles() requires IDENTITY_INSERT is ON

c#,sql,model-view-controller,simplemembership,user-roles
Migrated from LocalDB to SQL Server. Trying to add role to user: if (!Roles.GetRolesForUser("admin").Contains("Admin")) Roles.AddUsersToRoles(new[] { "admin" }, new[] { "Admin" }); and catching this: An explicit value for the identity column in table 'webpages_UsersInRoles' can only be specified when a column list is used and IDENTITY_INSERT is ON. ...

Get all roles of any user (yes, not currently logged one)

c#,asp.net,simplemembership
In an MVC app, administrator has a CRUD controller for managing users. Now, the functionality of the edit part needs to be extended and it involves adding a number role dependent tabs. They depend on the role of the viewed user, rather than on roles of the administrator who is...

MVC4 simplemembership not working after publish

asp.net-mvc-4,simplemembership
I have the following problem with using MVC4 SimpleMembership: Register and Login methods work fine in local debugg mode, but after publish they crash the site. The cause from what i saw is that for example when i register an user the information is stored in my UserProfile table but...

Register _LoginPartial if(Request.IsAuthenticated)

asp.net-mvc,simplemembership
I'm hitting a dead end with this one. I'm new to MVC and I see similiar issue appearing on SO, but it does not help. I'm basically trying to set a Register action, and once user is registered _LoginPartial view should indicate that the user is authenticated. From various posts...

Override a controller's [Authorize(Roles=“X”)] filter in an action of that controller

c#,asp.net-mvc,simplemembership
In an MVC app certain controller has access restricted by a role (there is an Authorize filter with a role attached to controller). Now the client decided that one of the actions in this controller should be available to all authenticated users (so AllowAnonymous filter alone won't do the trick...

How to migrate from SimpleMembership to ASP.NET.Identity

asp.net-mvc-4,asp.net-mvc-5,asp.net-identity,simplemembership
Migrating from MVC4 to MVC5 and want to use ASP.NET Identity too but I am struggling to find anything that covers everything I think I need to do to migrate the Identity. This link suggests all I need to do is create an ApplicationUser and migrate the data, and other...