asp.net-identity

ASP.NET Identity executes database query on every page request when logged in

人走茶凉 提交于 2019-12-11 04:07:28
问题 I have noticed that my ASP.NET Web Forms application based on Identity 2.2.1 fetches logged in user data from the database on every page request. Is this normal and designed behaviour? For performance reasons, user data might be cached in Session. I have double checked if I have not added extra code in master page which might cause this behaviour. But no, I am using standard Web Form template with no code added to the master page. SQL statement executed on every page request: SELECT [Extent1]

Autofac with ASP.NET Identity in MVC 5 does not validate Security Stamp in OWIN pipeline

做~自己de王妃 提交于 2019-12-11 03:35:00
问题 I set up AutoFac to work with ASP.NET Identity in MVC 5. Everything seemed to work fine on surface, i.e. users could create accounts and log in. But then I discovered that the users do not get logged out when Security Stamp is changed. Either by brute force in AspNetUsers table or by users changing password and expecting to be logged out in other browser. This is how I set up AutoFac by following this unofficial article. public void Configuration(IAppBuilder app) { var builder = new

Cross domain token based authentication using ASP.NET Identity and ASP.NET Web API 2

别说谁变了你拦得住时间么 提交于 2019-12-11 03:04:25
问题 I would like to know about the best practices to handle this authentication scenario. I have a registration page called (ie https://public.domain.com/#registration), after the registration is done, I'd like to authenticate the user and redirect him to the app (ie https://app.domain.com/). I have another server where I have the authentication method, api controllers, etc (ie https://api.domain.com/Token , https://api.domain.com/api/getOrders , etc). From the registration page (https://public

Implement ASP.NET Identity IUserLockoutStore without IUserPasswordStore

萝らか妹 提交于 2019-12-11 03:03:14
问题 I have MVC5 project and I don't have direct access to user database instead I was provided with web services, for example: bool register (string username, string password, string email) //password is plain text bool login (string username, string password) My problem is that I have no idea how to implement IUserPasswordStore because ASP Identity force me to use Hash while I'm not allowed to store hashed password because this web services will be used not just by me. My UserStore.cs: public

GenerateChangePhoneNumberTokenAsync on ASP.NET Core 2.0

懵懂的女人 提交于 2019-12-11 02:35:51
问题 Trying to use this code on ASP.NET Core 2.0 ApplicationUser MyUser = await _userManager.FindByNameAsync(model.Email); var Code = await _userManager.GenerateChangePhoneNumberTokenAsync(MyUser, model.MobileNumber); Results for variable "Code" is this instead of 6 digits. CfDJ8Kjv6NuVfg5GkZ9ZEJRMBG2BxkZ4fnbwTfkq5335ft3Lm0sCl7uaRXFce+uDMtXC8wgdoiocyXV4nGlBz25tkbZr4JvZ6/1gk6EenJKmkq2of3XXfK/xMWE/M2aqmkz9OJpOe75Wz+xlmgq

What's the best way to perform CRUD with ASP.NET Identity?

柔情痞子 提交于 2019-12-11 02:28:55
问题 By default, ASP.NET MVC's implementation of Identity for authentication does not support full CRUD operations for it's users. I know it already has : Register, Login, Manage, and Change Password But the problem is that doesn't have : Account Update or Edit, Select User Role, and Delete User I think that Identity is still incomplete in a way that there is no concise documentation which causes me to have a very ugly looking learning curve. Or if there's a better way and place to learn it, can

ASP MVC5 Identity User Abstraction

允我心安 提交于 2019-12-11 02:23:21
问题 I want to build N-tire web application with default Identity 2 provider. So, my Data layer contains pure c# classes with model definition, without any externad dependency. But it is impossible to link some classes to my Application User without adding AspNet.Identity reference. I have tried to make an interface of User class: public interface ISystemUser { string Id { get; set; } string Title { get; set; } } public class Place { public int Id { get; set; } public string Address { get; set; }

How do I tell UserManager.FindByIdAsync(userid); to include a relation?

放肆的年华 提交于 2019-12-11 02:05:31
问题 I added a new property and its corresponding table to my database using ASP.NET Identity with Code First like so: public class ApplicationUser : IdentityUser { .... public virtual ICollection<File> Files { get; set; } } public class File { .. public virtual ApplicationUser UserManager { get; set; } } Now, from some action, when I call: var user = await UserManager.FindByIdAsync(userid); it does get the user with the correct userid I want to Include method in Entity Framework to include the

Error: Multiple object sets per type are not supported

浪子不回头ぞ 提交于 2019-12-11 02:03:56
问题 Here is details of the error: There was an error running the selected code generator: 'Unable to retrive metadata for 'Models.ApplicationUser'. Multiple object sets per type are not supported. The objects sets 'ApplicationUsers' and 'Users' can both contain instances of type 'Models.ApplicationUser'. I am getting this while scaffolding a view in MVC project. I got the same error if i try to scafford a controller. I have seen a few of this error on SO but it seems those don't apply to my case.

How to add asp.net identity in asp.net core with visual studio code

淺唱寂寞╮ 提交于 2019-12-10 23:09:04
问题 This is my first project in asp.net core and now have come to the point where I need to implement asp.net identity for core mvc application in visual studio code. I looked up but neither I can find any blog and any document on Microsoft sites how to do it. If anyone can help me out, it will be great and sure many other will get answer to this. Thanks, Girish 回答1: You can create new project using dotnet new mvc --auth Individual command and then copy identity-related code to your project. 来源: