title: Asp.Net Identity Generate Password Reset Token from one Application Pool Identity and Verify on another
body: <p>We have a customer facing website and a back office for creating users. Creating a new user with a welcome email with password reset works flawlessly when running both application on IIS Express on our Developer machines. However when we deploy the applications and the applications are hosted on different IIS servers with different Application Pool Identities it stops working. </p>
  
  <p>We have been able to replicate the error offline on the same server but with different Application Pool Identities. If we switch so that the applications use the same Application Pool Identity in IIS everything starts working again. </p>
  
  <p>Back Office:</p>
  
  <pre><code>applicationDbContext = new ApplicationDbContext();
  userManager = new ApplicationUserManager(new ApplicationUserStore(applicationDbContext), applicationDbContext);
  var createdUser = userManager.FindByEmail(newUser.Email);
  var provider = new DpapiDataProtectionProvider("Application.Project");
  userManager.UserTokenProvider = new DataProtectorTokenProvider&lt;ApplicationUser, int&gt;(provider.Create("ASP.NET Identity"));
  var token = userManager.GeneratePasswordResetToken(createdUser.Id);
  </code></pre>
  
  <p>Customer Portal:</p>
  
  <pre><code>var applicationDbContext = new ApplicationDbContext();
  userManager = new ApplicationUserManager(new ApplicationUserStore(applicationDbContext), applicationDbContext);
  
  var user = await userManager.FindByEmailAsync(model.Email);
  if (user == null)
  {
      return GetErrorResult(IdentityResult.Failed());
  }
  
  var provider = new DpapiDataProtectionProvider("Application.Project");
  userManager.UserTokenProvider = new DataProtectorTokenProvider&lt;ApplicationUser, int&gt;(provider.Create("ASP.NET Identity"));
  
  //This code fails with different Application Pool Identities
  if (!await userManager.UserTokenProvider.ValidateAsync("ResetPassword", model.Token, userManager, user))
  {
      return GetErrorResult(IdentityResult.Failed());
  }
  
  var result = await userManager.ResetPasswordAsync(user.Id, model.Token, model.NewPassword);
  </code></pre>
  
  <p>IdentityResult says <code>Succeeded</code> false but no error code. Is there anyway around this or do we need to implement token generation and validation ourselves? </p>
  
  <p><a href="https://i.stack.imgur.com/tC1vc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tC1vc.png" alt="enter image description here"></a></p>