asp.net-identity

Forcing EF ApplicationUser To Load Navigation Properties

放肆的年华 提交于 2019-12-23 11:54:52
问题 I am using EF6/.Net 4.5.1 to retrieve data for a listview in a usercontrol on a webform. I have modified the ApplicationUser to include a Navigation Property [1:1] using a FK attribute which has been working great. public class ApplicationUser : IdentityUser { public ApplicationUser() { CreateDate = DateTime.Now; :\\ deleted stuff } public int TaxID { get; set; } public System.Guid ApplicationId { get; set; } :\\ deleted stuff [ForeignKey("TaxID")] public virtual Personnel Personnel { get;

ASP.NET Identity Confirmation Email Is Plain Text Instead of HTML

不羁岁月 提交于 2019-12-23 10:49:33
问题 In an ASP.NET MVC5 C# application I am using the standard code for sending confirmation emails when a user registers, something I've done in multiple projects: var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); Normally when the recipient receives the email, it's content

How to make Login page as a default route in ASP .NET Core 2.1?

*爱你&永不变心* 提交于 2019-12-23 09:29:30
问题 I am beginner in ASP .NET Core 2.1 and working on project which is using ASP .NET Core 2.1 with individual authentication. I want to make my login page as my default route instead of Home/Index: routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); Any help how can i change it as ASP .NET Core 2.1 as Login is now used as a razor page instead of MVC Action View. 回答1: Use this in ConfigureServices method. services.AddMvc().AddRazorPagesOptions(options=> {

Adding Identity to an existing project

断了今生、忘了曾经 提交于 2019-12-23 09:29:17
问题 I've got an MVC project, and I want to add Identity to it, but I can't seem to find any good articles on how to do so. Is there an easy way to add Identity to an existing project? I already have a database with stuff in it 回答1: Well, in one respect, you simply have to add the Nuget package and start writing code with it, but I think you're probably talking about all the extras: the pre-written code and samples for doing things like password resets, two-factor auth, etc. For that, no, there's

Why did the new ASP.NET Identity tables stop using Guid (uniqueidentifier type) as keys?

我们两清 提交于 2019-12-23 09:01:07
问题 I'm trying to understand why the new ASP.NET Identity tables stopped using Guid (uniqueidentifier type) as keys - instead it is now using nvarchar(128) but still keep a Guid as a string ... Isn't it a huge waste? ( uniqueidentifier is just 2 integers vs the whole Guid as a 36 character string ) I'm suspecting that Entity Framework might be responsible for this... Is it safe to change back to uniqueidentifier keys? Can anyone tell me what are the benefits of using 36 character strings? 回答1:

AddIdentity() fails “InvalidOperationException: Scheme already exists: Identity.Application”

隐身守侯 提交于 2019-12-23 07:39:13
问题 Im trying to add facebook login to my .NET Core 2.1 site Im following this , guide and more specific, this (for facebook login) After have adding the lines below to startup.cs, inside ConfigureServices-method public void ConfigureServices(IServiceCollection services) { ... services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); ... } I get the error message, when Im running the application. Without these lines it

ASP.NET Identity Two Factor not working - Cookie Issue?

无人久伴 提交于 2019-12-23 07:38:08
问题 Background: I have been using the Identity-Sample project provided by the Microsoft team here: I have integrated the Identity-Sample project & prerelease nuget packages into an existing project, that was previously using the latest stable version of Identity. Problem: When trying 2FA, inside the Account/SendCode method, there is a call to GetVerifiedUserIdAsync() , which is part of the Microsoft.AspNet.Identity.Owin.SignInManager class. (see the full code here) GetVerifiedUserIdAsync() is

How are Authentication type names registered in asp.net vnext

余生长醉 提交于 2019-12-23 07:09:00
问题 So I am updating an Open Source asp.net Identity provider for MongoDB to work with Asp.Net Identity 3.0 (aka vnext). So far I have been able to register the provider and create users but when using the SignInManager if a correct UserName/Pass is provided I get the error InvalidOperationException: The following authentication types were not accepted: Microsoft.AspNet.Identity.Application I have tracked down the error to here https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft

User logout after non-persistent login in Asp.Net Identity 2

若如初见. 提交于 2019-12-23 05:05:01
问题 I am trying to configure Asp.Net Identity 2.2 to be able to login normally and permanently. I know there are two settings to get into account, the validateInterval of the CookieAuthenticationProvider and the ExpireTimeSpan of the CookieAuthenticationOptions. Here is the standard configuration which comes with a new MVC 5 application, with the ExpireTimeSpan and SlidingExpiration set explicitly to their default values just to have them in mind: app.UseCookieAuthentication(new

Customization and integration of own database with mvc5 identity [closed]

天涯浪子 提交于 2019-12-23 04:35:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm working on an MVC project that required an authentication and authorization which will be created using Identity, also my project database includes main entities that should use the system, what is the best practice to deal with that situation. Should I customize the identity