Questions tagged [asp.net-identity]

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems.

The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. It includes profile support, OAuth integration, works with OWIN, and is included with the ASP.NET templates shipped with Visual Studio 2013.

ASP.NET Identity uses code-first Entity Framework to allow for maximum customization through class manipulation, annotation, and new fluent API.

Useful links

7887 questions
399
votes
10 answers

ASP.NET Identity - HttpContext has no extension method for GetOwinContext

I have downloaded, and successfully ran the ASP.NET Identity sample from here: https://github.com/rustd/AspnetIdentitySample I am now in the middle of implementing the ASP.NET Identity framework in my project and have ran into a problem, that has…
Darren Wainwright
  • 28,457
  • 19
  • 68
  • 116
244
votes
10 answers

ASP.NET MVC 5 - Identity. How to get current ApplicationUser

I have an Article entity in my project which has the ApplicationUser property named Author. How can I get the full object of currently logged ApplicationUser? While creating a new article, I have to set the Author property in Article to the current…
Ellbar
  • 3,743
  • 6
  • 19
  • 31
224
votes
18 answers

How to get the current logged in user ID in ASP.NET Core?

I've done this before with MVC5 using User.Identity.GetUserId() but that doesn't seem to work here. The User.Identity doesn't have the GetUserId() method. I am using Microsoft.AspNet.Identity.
MRainzo
  • 3,084
  • 2
  • 13
  • 24
222
votes
7 answers

How can I change the table names when using ASP.NET Identity?

I am using the release version (RTM, not RC) of Visual Studio 2013 (downloaded from MSDN 2013-10-18) and therefore the latest (RTM) version of AspNet.Identity. When I create a new web project, I select "Individual User Accounts" for authentication.…
user2315985
  • 3,608
  • 5
  • 15
  • 16
202
votes
4 answers

ASP.NET Identity DbContext confusion

A default MVC 5 App comes with this piece of code in IdentityModels.cs - this piece of code is for all the ASP.NET Identity operations for the default templates: public class ApplicationDbContext : IdentityDbContext { public…
199
votes
4 answers

What is the claims in ASP .NET Identity

Can somebody please explain, what the claim mechanism means in new ASP.NET Identity Core? As I can see, there is an AspNetUserLogins table, which contains UserId, LoginProvider and ProviderKey. But, I still can't understand or find any information…
Maxim Zhukov
  • 9,627
  • 5
  • 37
  • 78
192
votes
3 answers

What is ASP.NET Identity's IUserSecurityStampStore interface?

Looking at ASP.NET Identity (new membership implementation in ASP.NET), I came across this interface when implementing my own UserStore: //Microsoft.AspNet.Identity.Core.dll namespace Microsoft.AspNet.Identity { public interface…
Brian Chavez
  • 6,945
  • 5
  • 51
  • 43
190
votes
5 answers

Where are the Login and Register pages in an AspNet Core scaffolded app?

In VS 2017, I created a new ASP.NET Core Web Application. On the second page of the wizard, I chose Web Application, and for Authentication, I chose "Individual User Accounts". Now, I'm trying to find the Pages associated with /Account/Register and…
Bob.at.Indigo.Health
  • 9,166
  • 11
  • 51
  • 93
185
votes
15 answers

Unauthorised webapi call returning login page rather than 401

How do I configure my mvc/webapi project so that a webapi method called from a razor view doesn't return the loginpage when its unauthorised? Its a MVC5 application which also has WebApi controllers for calls via javascript. The two methods…
Tim
  • 7,111
  • 12
  • 57
  • 98
181
votes
4 answers

ASP.NET Identity's default Password Hasher - How does it work and is it secure?

I am wondering wether the Password Hasher that is default implemented in the UserManager that comes with MVC 5 and ASP.NET Identity Framework, is secure enough? And if so, if you could explain to me how it works? IPasswordHasher interface looks like…
André Snede
  • 8,907
  • 6
  • 41
  • 61
179
votes
3 answers

Adding ASP.NET MVC5 Identity Authentication to an existing project

I have seen lots of similar pages on the web, but most of them use a new project instead of an existing one, or don't have the necessary features. So, I have an existing MVC 5 project and want to integrate ASP.NET MVC5 Identity with log in, email…
Jack
  • 1
  • 15
  • 75
  • 149
161
votes
9 answers

How to get current user, and how to use User class in MVC5?

How can I get the id of the currently logged in user in MVC 5? I tried the StackOverflow suggestions, but they seem to be not for MVC 5. Also, what is the MVC 5 best practice of assigning stuff to the users? (e.g. a User should have Items. Should…
Adam Szabo
  • 10,892
  • 17
  • 58
  • 99
157
votes
9 answers

ASP.NET_SessionId + OWIN Cookies do not send to browser

I have a strange problem with using Owin cookie authentication. When I start my IIS server authentication works perfectly fine on IE/Firefox and Chrome. I started doing some testing with Authentication and logging in on different platforms and I…
Piotr Stulinski
  • 8,375
  • 8
  • 28
  • 45
156
votes
14 answers

How to get current user in asp.net core

I want to get the current user, so I can access fields like their email address. But I can't do that in asp.net core. This is my code: HttpContext almost is null in constructor of controller. It's not good to get a user in each action. I want to get…
Mehran Hafizi
  • 1,890
  • 2
  • 9
  • 14
132
votes
6 answers

How to extend available properties of User.Identity

I'm using MVC5 Identity 2.0 for users to log into my website, where the authentication details are stored in an SQL database. Asp.net Identity has been implemented in a standard way as can be found in many online tutorials. The ApplicationUser class…
RobHurd
  • 1,931
  • 7
  • 25
  • 29
1
2 3
99 100