Closed pjtalkstech closed 5 years ago
Hi @chintupawan
This is a great question. I don't do much front-end stuff so I hope I can help. Are you using CORS? Does an Ajax call route into the correct controller/action?
Can you post the Ajax code you are using? Can you also post your ConfigureServices
and Configure
methods in the ASP.NET Core startup?
In theory an Ajax call should work just like a regular call from ASP.NET Core's perspective.
I am traveling this week, but I can take a closer look this weekend.
@achandlerwhite thanks for your quick response. I was using Finbuckle Multitent Middleware inside another Middleware. My order of registration of these Middlewares are wrong. Multitenant Middleware should go first. Once I do this I see Items property is filled with MultiTenantContext.
Thanks
I’m glad you figured it out. Let me know if you run into any more problems.
I see the source code GetMultiTenantContext extension method relies on HttpContext's Items dictionary property. If it is full page post back Items property has tenant information. If it is Ajax call Items property is empty. Is there way to make it work for Ajax calls.
Sorry if this previously answered.