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

8860 questions
48
votes
7 answers

"Context cannot be used while the model is being created" exception with ASP.NET Identity

Why is this happening when we make a call to the AccountApiController.Register() method? what is trying to use the context? what is trying to create the context? how do we avoid this? how do we debug this? "Message":"An error has…
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
48
votes
5 answers

ASP.NET (OWIN) Identity: How to get UserID from a Web API controller?

(Using VS2013 RTW, ASP.NET MVC5) I've seen lots of documentation on how to add properties to the ApplicationUser class (and table) when using ASP.NET identity. But I haven't seen any documentation on how to have a separate table with content that…
46
votes
7 answers

ASP.NET core, change default redirect for unauthorized

I am attempting to redirect to a different login url in ASP.NET MVC6 My account controller login method has a Route attribute to change the url. [HttpGet] [AllowAnonymous] [Route("login")] public IActionResult Login(string returnUrl = null) { …
Jim
  • 14,952
  • 15
  • 80
  • 167
46
votes
2 answers

No Individual User Accounts auth option in ASP.NET Core Web API template

I am a bit confused as to why there is no Individual User Accounts authentication option in the latest ASP.NET Core Web API template. Is it still possible to implement individual user accounts the way that the MVC template does or would it not make…
46
votes
6 answers

ASP.NET Identity + Windows Authentication (Mix mode - Forms + Windows)

I have tried my best to search the web before asking this question. I've seen similar questions on stackoverflow, however, none has been answered satisfactorily for a long time now. This is one more attempt to get this recurring question…
46
votes
10 answers

Disable User in ASPNET identity 2.0

I am looking for a way to disable the user instead of deleting them from the system, this is to keep the data integrity of the related data. But seems ASPNET identity only offers Delete Acccount. There is a new Lockout feature, but it seems to…
anIBMer
  • 1,159
  • 2
  • 12
  • 20
45
votes
10 answers

ASP.NET Identity Provider SignInManager Keeps Returning Failure

I have an issue with the standard ASP Identity provider for MVC5. As soon as I log in the method: await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); keeps returning Failure. So I started…
Jacques Bronkhorst
  • 1,685
  • 6
  • 34
  • 64
45
votes
2 answers

How to change table names for ASP.net Identity 2.0 with int ID columns?

I've used ASP.net membership for years and am just starting to try out ASP.net Identity. They just released version 2.0 and which is supposed to support int primary keys. I've defined my custom identity classes as follows in order to get integer…
Sam
  • 9,933
  • 12
  • 68
  • 104
45
votes
4 answers

ASP.NET Identity Cookie across subdomains

For forms authentication I used this in web.config (note the domain attribute):
orourkedd
  • 6,201
  • 5
  • 43
  • 66
45
votes
6 answers

How to obtain a list of Users from ASP.NET Identity?

Edit: This question is outdated The Identity Framework was a moving target at the moment I asked this. The authors changed quite a few things and they have decoupled several others, making everything easier. Have a look at the Asp.NET Identity…
44
votes
6 answers

ASP.NET Core MVC: setting expiration of identity cookie

In my ASP.NET Core MVC app the lifetime of the authentication cookie is set to 'Session', so it lasts until I close the browser. I use the default authentication scheme for MVC: app.UseIdentity(); How can I extend the lifetime of the cookie?
severin
  • 5,203
  • 9
  • 35
  • 48
44
votes
2 answers

Configure the authorization server endpoint

Question How do we use a bearer token with ASP.NET 5 using a username and password flow? For our scenario, we want to let a user register and login using AJAX calls without needing to use an external login. To do this, we need to have an…
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
44
votes
1 answer

Decoupling ASP.NET MVC 5 Identity to allow implementing a layered application

I'm new to ASP.NET MVC and I've been developing a MVC 5 application with individual user authentication. I've been doing a layered pattern when doing my applications like separating Model layer, DAL layer, Repos, etc. etc. but now in MVC 5, I want…
Bairose
  • 713
  • 1
  • 7
  • 15
44
votes
7 answers

Add User to Role ASP.NET Identity

I know the new Membership includes a "Simple Role Provider." I can't find any help related to creating a user and assigning a role when the user is created. I've added a user which created the tables on the DB correctly. I see the AspNetRoles,…
Brad Martin
  • 5,637
  • 4
  • 28
  • 44
43
votes
5 answers

How to plug my Autofac container into ASP. NET Identity 2.1

I have been looking into the new features of the new version of ASP.NET Identity 2.1 and one of its enhancements is the new IoC features integrated into the OWIN Middleware. One of the sentences that I looked in the examples is this…
renelopez
  • 485
  • 1
  • 5
  • 9