Giter VIP home page Giter VIP logo

aspnet-identity-2-extensible-project-template's People

Contributors

xivsolutions avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspnet-identity-2-extensible-project-template's Issues

ApplicationUser must be convertible to microsoft.aspnet.identity.framework.identityuser inorder to use it as parameter TUser

Thank you so much for the template. I am not very experienced program however manage to use the template. I am trying to import users information from an old project using SqlMembership, I need to use SQLPasswordHasher which I got from this example: http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity.

I am trying to add UserManger:
public MyUserManager ()
: base(new UserStore(new ApplicationDbContext()))
{
this.PasswordHasher = new SQLPasswordHasher();
}
I get the above error.
When I change the public class ApplicationUser : IdentityUser I don't get this error

I would appreciate your suggestions.

each line of above Register method that exist 'RoleManager' word I'm getting compile time error as below

   // POST: /Account/Register
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Register(RegisterViewModel model, HttpPostedFileBase upload, params string[] selectedRoles)
    {

        try
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser { UserName = model.UserName, Email = model.Email };                      


                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    //Add User to the selected Roles 
                    if (selectedRoles != null)
                    {
                        var addroles = await UserManager.AddToRolesAsync(user.Id, selectedRoles);
                        if (!addroles.Succeeded)
                        {
                            ModelState.AddModelError("", result.Errors.First());
                            ViewBag.RoleId = new SelectList(await RoleManager.Roles.ToListAsync("Name", "Name"));
                            return View();
                        }
                    }

                }

                else
                {
                    ModelState.AddModelError("", result.Errors.First());
                    ViewBag.RoleId = new SelectList(RoleManager.Roles, "Name", "Name");
                    return View();
                }

                return RedirectToAction("Index");
                // AddErrors(result);
            }

        }

        // If we got this far, something failed, redisplay form
        catch (RetryLimitExceededException /* dex */)
        {
            //Log the error (uncomment dex variable name and add a line here to write a log.
            ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
        }

        ViewBag.RoleId = new SelectList(RoleManager.Roles, "Name", "Name");

        return View(model);
    }

Using the generic type 'RoleManager' requires 2 type arguments

which means I'm getting 3 compile time errors in above method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.