title: Multiple & SubDomain's cookie in asp.net Core Identity
body: <p>I have a webpage which uses multiple URLS for the same application:</p>
  
  <p>for example: 
     *.MyWebPage.com.au
     *.YourWebPage.com.au</p>
  
  <p>So it will use subdomains on multiple urls. The problem is I need to allow for the user to be authenticated on all subdomains of the url which they have logged into.</p>
  
  <p>For example, if they login via www.mywebpage.com.au the cookie needs to be set for *.mywebpage.com.au or if they login via www.yourwebpage.com.au the cookie should be *.yourwebpage.com.au.</p>
  
  <p>Most of the documentation in allowing subdomains for ASP.NET core identity points to the startup.cs (or startup.auth.cs) file and entering something like this:`            </p>
  
  <pre><code>app.UseCookieAuthentication(new CookieAuthenticationOptions()
              {
                  CookieDomain = "mywebpage.com.au"
              });`
  </code></pre>
  
  <p>this will not work for me because I dont want a fixed domain, I just want to allow for all the users to have access to all the subdomains for the url they have signed in at.  I can obviously get their url at the time of login via the request, but I need to dynamically set the cookiedomain at this point.  </p>