I am currently using the Angular and .NET core template for ASP.NET ZERO. When I am serving the admin panel locally and change the tenant it is working fine image.
However when I publish the website on a shared hosting platform the tenant ID is not being read by the API AbpSession.TenantId.HasValue
is returning NULL, thus making me always log in as host instead of tenant image.
I checked the request headers and it is passing the tenant ID successfully but the GetCurrentLoginInformations always returns tenant as NULL even after specifying the tenant ID multiple times.
Request Header:
:authority: api-website.domain.com
:method: GET
:path: /api/services/app/Session/GetCurrentLoginInformations
:scheme: https
abp.tenantid: 3
accept: text/plain
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
expires: Sat, 01 Jan 2000 00:00:00 GMT
origin: https://admin-website.domain.com
pragma: no-cache
referer: https://admin-website.domain.com/
sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-site
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
x-requested-with: XMLHttpRequest
UPDATE
When I login as a host then login as a tenant from the admin view I get the following error:
System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 3
It seems for whatever reason AbpSession.TenantId is null or undefined even though it is being passed in the request headers.
So after a lot of trying it finally worked, I still don't know why but if I changed the name of the Tenant ID request header/cookie it worked. I removed the dot and replaced it with a dash to "abp-tenantid".