I have this error ' The namespace or type ApplicationSignInManager, ApplicationUserManager, ApplicationRoleManager could not be found, missing some directive'. The problem is i do have the relevant assemblies but i am still getting this issue and did clean as well built my applicatio. Please help me mates to resolve this issue.
-
-
- using System;
- using eNtsaTrainingRegistration.Models;
- using Microsoft.AspNet.Identity.Owin;
- using System.IO;
- using System.Configuration;
- using System.Net.Http;
- using System.Net.Http.Headers;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using eNtsaTrainingRegistration.Helper;
- using eNtsaTrainingRegistration.App_Start;
-
-
- namespace eNtsaTrainingRegistration.Controllers
- {
- [HandleError(ExceptionType = typeof(Exception), View = "InternalError")]
- public class HomeController : AppBaseController
- {
-
-
- private ApplicationSignInManager _signInManager;
- private ApplicationUserManager _userManager;
- private ApplicationRoleManager _roleManager;
-
- public HomeController()
- {
-
- }
-
- public HomeController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager)
- {
- UserManager = userManager;
- SignInManager = signInManager;
- AppRoleManager = roleManager;
- }
-
-
- public ApplicationSignInManager SignInManager
- {
- get
- {
- return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
- }
- private set
- {
- _signInManager = value;
- }
- }
-
- public ApplicationUserManager UserManager
- {
- get
- {
- return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
- }
- private set
- {
- _userManager = value;
- }
- }
-
- public ApplicationRoleManager AppRoleManager
- {
- get
- {
- return _roleManager ?? Request.GetOwinContext().GetUserManager<ApplicationRoleManager>();
- }
- private set
- {
- _roleManager = value;
- }
- }
-
-
- [AuthorizeRole(Roles = "SuperAdmin, AdminUser, PendingUSers")]
- [OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
- public ActionResult Index()
- {
- var pendingUserRoleId = AppRoleManager.Roles.SingleOrDefault(r => r.Name == "PendingUsers").Id;
- var pendingUsers = (from user in UserManager.Users
- select new
- {
- UserId = user.Id,
- Username = user.FirstName,
- Useremail = user.Email,
- UserroleId = user.Roles.FirstOrDefault().RoleId,
- EmailConf = user.EmailConfirmed,
- })
- .Where(u => u.UserroleId == pendingUserRoleId)
- .Where(u => u.EmailConf == true)
- .Select(p => new RoleViewModel()
- {
-
- });
-
- return View(pendingUsers);
- }
- protected override void Dispose(bool disposing)
- {
- if(_userManager !=null)
- {
- _userManager.Dispose();
- _userManager = null;
- }
- if(_signInManager !=null)
- {
- _signInManager.Dispose();
- _signInManager = null;
- }
- if(_roleManager !=null)
- {
- _roleManager.Dispose();
- _roleManager = null;
- }
-
- base.Dispose(disposing);
- }
-
- }
-
-
- }