Questions tagged [asp.net-identity-2]

The second release of the ASP.NET Identity system which was designed to replace the previous ASP.NET Membership and Simple Membership systems. Use this tag if your question deals specifically to ASP.NET Identity 2 features. The [asp.net-identity] tag should be used if your question is not specific to ASP.NET Identity 2.

Resources:

Announcing RTM of ASP.NET Identity 2.0.0

1064 questions
18
votes
3 answers

Suppress redirect on API URLs in ASP.NET Core

I have an ASP.NET Core site that uses cookie authentication for most pages. For those pages, the default server response of providing a 302 redirect for an unauthorized client is desirable. However, the site also accepts API requests; they use API…
18
votes
1 answer

ASP.NET Identity - custom UserManager, UserStore

I am a bit confused with customizing UserManager and UserStore. Out of the box solution comes with EF implementation and i don't want to use EF but my own DAL that uses MSSQL. I want to have Claims based security where one of the users Claims will…
dee zg
  • 10,582
  • 7
  • 33
  • 59
18
votes
3 answers

Should I separate my application context from ApplicationDbContext used for identity?

In Visual-Studio 2013, when creating an ASP.NET project, it generates a file IdentityModels.cs that contains a class ApplicationDbContext, that inherits from IdentityDbContext, which eventually inherits from DbContext. Should I keep…
Shimmy Weitzhandler
  • 92,920
  • 119
  • 388
  • 596
17
votes
5 answers

aspnet identity invalid token on confirmation email

I'm trying to confirm an account but I'm getting "invalid token." error. Here's what I'm trying: var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmacaoEmail", "Usuario", new { userId =…
Thiago Custodio
  • 13,761
  • 6
  • 36
  • 74
17
votes
2 answers

Add user First Name and Last Name to an ASP.NET Identity 2?

I changed over to use the new ASP.NET Identity 2. I'm actually using the Microsoft ASP.NET Identity Samples 2.0.0-beta2. Can anyone tell me where and how I can modify the code so that it stores a user First and Last name along with the user…
user1943020
16
votes
2 answers

ApplicationUserManager.Create called on every request

I'm using asp.net mvc 5 with external provider owin provide (facebook, twitter) ApplicationUserManager.Create is called on every request. There is a lot of unnecessary stuff for logged in user in there (password validator configuration or sms and…
MDu
  • 191
  • 1
  • 6
16
votes
2 answers

Creating Asp.net Identity user in Seed method of Db Initializer

I have created my data layer with EF 6 code first and I am populating the db through Seed method of EvInitializer class inheriting from DropCreateDatabaseIfModelChanges. The implementation of Seed method is protected override void Seed(EvContext…
16
votes
1 answer

ASP.NET Identity 2.0 implementation without Entity Framework

Is there a custom implementation for ASP.NET Identity 2.0 that does not use Entity Framework? I'm hoping for something that does not use a full blown ORM but something along the lines of Dapper. The reason I'm asking is because I am not using Entity…
Ryan Rodemoyer
  • 5,040
  • 12
  • 39
  • 51
16
votes
3 answers

Cannot login on ASP.NET Identity 2 site after programmatic user creation

I have a new MVC 5 razor, EF 6 web application using ASP.NET Identity 2 for the membership system. When I create the users manually using the Register link on the web page, it goes fine. I can create the user, I can then login with the given…
Lord of Scripts
  • 3,420
  • 5
  • 35
  • 59
15
votes
1 answer

Url Authorization with MVC and ASP.NET Identity

I want to secure specific folders and resources in my application that are outside of the routes for my mvc application. I want these resources to only be available to authenticated users (which role is not of concequence as long as they are…
Igor
  • 55,253
  • 10
  • 80
  • 149
15
votes
4 answers

Seed database for Identity 2

I came across a problem for seeding the database with Identity v2. I separated out the IdentityModel from the MVC5 project to my Data Access Layer where I setup EF Migrations as well. So I commented out the code which use inside "IdentityConfig.cs"…
Ammar Khan
  • 2,455
  • 6
  • 30
  • 57
14
votes
3 answers

Creating users with no password using ASP.NET Identity

I have been given the requirement to provide the ability to create users through the UI with no password. I am trying to accomplish this using ASP.NET Identity. I am able to successfully create a user without a password using the UserManager's…
Sam Parsons
  • 499
  • 1
  • 6
  • 17
14
votes
2 answers

Usage of User.IsInRole() in a View

In my mvc5 project to disable an action link for unauthorized users i did like this @if (User.IsInRole("Admin") | User.IsInRole("Manager")) { @Html.ActionLink("Add New Record", "ProductTypeIndex", "ProductType") } But if there are many…
Isuru
  • 900
  • 1
  • 10
  • 31
14
votes
1 answer

Using UserManager.FindAsync with a custom UserStore

I have implemented a custom UserStore, it implements IUserStore and IUserPasswordStore. My Login action method is as below: if (ModelState.IsValid) { if (Authentication.Login(user.Username,…
Akbari
  • 2,239
  • 6
  • 36
  • 78
14
votes
4 answers

Get ASP.NET Identity Current User In View

I use ASP.NET Identity 2.0 and MVC. I need to logged user's name,surname,email etc.. in view. How can get it? I can get just @User.Identity but there no my user class's property. //in my view, i need here my ApplicationUser…
Yargicx
  • 1,460
  • 2
  • 15
  • 27
1 2
3
70 71