Posts

Showing posts with the label IIS

ASP.NET Identity Email Confirmation Token

Image
ASP.NET Identity has an Email Confirmation feature that you can (and should) enable. It will send an email with a token based Url to a registered user to simply confirm their email to allow them access into a web application. That token gets generated & stored in memory and therefore may be lost if the user does not confirm their account promptly. Code Settings Depending on the version of ASP.NET Identity the default  TokenLifespan  setting varies but the most recent version is supposed to be  24 hours  but an earlier version had it set to as low as  3 minutes.  Below is an example of how to set it directly within the  Account  controller to a 12 hour duration, you could inject the  dataProtectorProvider  via an IoC container then pass it to the constructor or just within the default  Startup.cs . public AccountController(IdentityUserManager userManager) { var dataProtectorProvider = Startup.DataProtectionProvider; ...