title: Core Identity returning wrong URL for 'ApplicationCookie.LoginPath' ASP MVC Core app on Azure App Service
body: <p>I have 3 ASP MVC Core webapps running on an Azure AppService using ASP MVC version 1.1.2  Each app has 1 staging slot in addition to the main site (for a total of 6 addresses). This issue effects 4 of the 6 (not sure if that is relevant but it's odd). From what I can tell I'm getting the wrong URL back from the cookie authentication when the user is not authenticated.</p>
  
  <p>The configuration for identity is on all the sites is:</p>
  
  <pre><code>        services.Configure&lt;IdentityOptions&gt;(options =&gt;
          {
              // Password settings
              options.Password.RequireDigit = true;
              options.Password.RequiredLength = 8;
              options.Password.RequireNonAlphanumeric = false;
              options.Password.RequireUppercase = true;
              options.Password.RequireLowercase = false;
  
              // Lockout settings
              options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);
              options.Lockout.MaxFailedAccessAttempts = 10;
  
              // Cookie settings
              options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromMinutes(30);
              options.Cookies.ApplicationCookie.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/LogIn");
              options.Cookies.ApplicationCookie.LogoutPath = "/Account/LogOff";
              options.Cookies.ApplicationCookie.CookieName = "ApplicationAdmin";
              options.Cookies.ApplicationCookie.SlidingExpiration = true;
  
              // User settings
              options.User.RequireUniqueEmail = true;
  
          });
  </code></pre>
  
  <p>Up until yesterday afternoon it worked as expected.  If the user was not authenticated and went to any URL within the app the application would route the user to:</p>
  
  <pre><code>client.mydomaim.com/Account/LogIn
  </code></pre>
  
  <p>Which is as expected from the settings shown above.  Starting yesterday afternoon (with no updating of the application recently) the URL that would return if the user was not authenticated was:</p>
  
  <pre><code>client:80/Account/LogIn
  </code></pre>
  
  <p>I get the sub-domain back with :80, this happens on the other sub-domains as well. Of course this results in a DNS error as 'client:80' is not a valid URL  There are, oddly, 2 staging slots that continue to work correctly using the same exact code.</p>
  
  <p>If I enter the full login address in the browser manually, like this:</p>
  
  <pre><code>client.mydomain.com/Account/LogIn
  </code></pre>
  
  <p>It works as expected and I can login and continue to use the app as always. Somewhere in the process the root URL is getting changed.  Is this cached somewhere?</p>
  
  <p>Additional information that might be helpful:</p>
  
  <ul>
  <li>This happens on the primary sites that use custom domains as well as a slot that uses the generic *.azurewebsites.net address.</li>
  <li>The error started appearing on one of the sub-domains and then spread to the others.  It wasn't until later in the evening that it starting happening on the staging slots.</li>
  <li>Two of the staging slots still work as expected (again, hosting the exact same code)</li>
  </ul>
  
  <p>Any thoughts would be appreciated.  I have a support ticket in with Azure as well but have yet to hear back from them.</p>
  
  <p>Thank you,
  Brian</p>