TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sonal malhotra
NA
410
51.6k
Error Role Administrator does not exist in identity mvc
Dec 12 2019 1:56 AM
hi everyone,
i registered name email n contact number in identity ... then i put coded in controller here below
public
async Task Register(RegisterViewModel model)
{
if
(ModelState.IsValid)
{
var user =
new
ApplicationUser { Name = model.Name, UserName = model.Email, Email = model.Email, IsActive =
true
};
var result = await UserManager.CreateAsync(user, model.Password);
if
(result.Succeeded)
{
// error shown like this below in red color
UserManager.AddToRole(user.Id,RoleName.AdministratorRoleName);
// RoleName.AdministratorRoleName ="Admin" given value
UserManager.AddClaim(user.Id,
new
Claim(ClaimTypes.GivenName, model.Name));
await SignInManager.SignInAsync(user, isPersistent:
false
, rememberBrowser:
false
);
Anybody can solve? please support me
Reply
Answers (
2
)
Histogram in Asp.net using Canvas.js
How to add Single Bill No , Many products