Multiple & SubDomain's cookie in asp.net Core Identity

前端 未结 4 1632
情深已故
情深已故 2020-12-03 18:24

I have a webpage which uses multiple URLS for the same application:

for example: *.MyWebPage.com.au *.YourWebPage.com.au

So it will use subdomains on

4条回答
  •  猫巷女王i
    2020-12-03 18:59

    Addition to @michael's answer: How to "handle the deletecookie event, adding options.Domain = RemoveSubdomain(context.Request.Host.Host)": just add

    options.Domain= RemoveSubdomain(context.Request.Host.Host);
    

    before

        ConcreteManager.DeleteCookie(context, key, options);
    

    in

    CookieManager.DeleteCoockie(..){..};

    And don't forget to call CookieManager.DeleteCoockie on logout!

    PS Also, if you need to be able to login both on subdomain.example.com and on example.com - you need to modify AppendResponseCookie(..){..}, or you will get only TLD (.com/.ru etc) here

提交回复
热议问题