After deployment to IIS the tenant impersonation as a host user is not working correctly (if you return from the Tenant back to the Host).
I have the dynamic url set in the appsettings.production.json configuration file:
"WebSiteRootAddress": "https://{TENANCY_NAME}.domain.com/"
This is working ok, <a class="postlink" href="http://tenant1.domain.com">http://tenant1.domain.com</a> gives the tenant 1 part, <a class="postlink" href="http://tenant2.domain.com">http://tenant2.domain.com</a> gives the tenant2 part.
Also impersonation the tenant admin user is working correctly, but when returning to the host part, the url is <a class="postlink" href="http://domain.com/Account/ImpersonateSignIn?tokenId=3a7c88c3-2d2b-443a-b013-55d59898d5a2">http://domain.com/Account/ImpersonateSi ... d59898d5a2</a> and it gives an internal server error page.
In the logfile I can see the following error :
Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: 2, given tenantId:
Any idea how to fix this ?
10 Answer(s)
-
0
I noticed that when the impersonation of a tenant user is done, there is a cookie placed in the root website which contains the imporonated Tenant Id.
If I remove this cookie before returning to the host portal it's working ok ? -
0
the expected behavior of this scene
1- you login as host (no tenant related cookies)
2- you impersonate as one of the tenants (puts Abp.TenantId cookie)
3- you revert back to host (removes Abp.TenantId)so in your case, if the cookie is not being removed when you turn back to host, you need to check it
-
0
Thanx, but what would I check exactly ?
I already mentioned I get an exception page on returning to the host.
In the logfile I see the following error :Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: 2, given tenantId:
Is the problem to be searched for in the aspnetzero code or in the boilerplate code ?
I also wonder why the cookie is needed since it seems to be working also without it ? -
0
Hi @GeertVeenstra,
What is your ABP and AspNet Zero versions ? As I remember there was a bug in one of the previous versions.
-
0
Hi,
I am testing on the latest zero version (5.1)
-
0
<cite>GeertVeenstra: </cite>
Thanx, but what would I check exactly ?I already mentioned I get an exception page on returning to the host.
In the logfile I see the following error :Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: 2, given tenantId:
Is the problem to be searched for in the aspnetzero code or in the boilerplate code ?
I also wonder why the cookie is needed since it seems to be working also without it ?Check if the scenario is working as I told you.
Is the abp.tenantId cookie being removed when you switch back to host -
0
The abp.tenant cookie is not deleted on returning to the host.
-
0
@GeertVeenstra,
A few questions;
-
Can you write your project type ? ASP.NET Core & Angular, ASP.NET Core & jQuery or MVC 5.x ?
-
Are you hoısting your app on azure or a local server ? If it is local, is it windows server or any other one ?
-
Finally can you share your config files which contains website addresses via email with us ? You can send it to <a href="mailto:info@aspnetzero.com">info@aspnetzero.com</a>.
-
-
0
I am having the same issue on the latest version of ASP.NET Zero. I am using ASP.NET Core jQuery version and it is hosted on Azure. Did you find a resolution to your issue? The cookie is not being deleted when I return to host.
-
0
@twig202 could you share url config in appsettings.json ? have you used {TENANCY_NAME} placeholder ?