khelben / IdsvrMultiTenantExample

An example project with multi tenant hosted Identityserver4
49 stars 13 forks source link

Client Side Assets Issue #2

Closed dotnetron closed 7 years ago

dotnetron commented 7 years ago

So 1 issue I am running into is client side assets like css & js files referenced in the views. For example, my layout file has the following:

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />

When I access the login page using the tenant specific url, it gets rendered in the html this way:

<link rel="stylesheet" href="/tenants/tenant1/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="/tenants/tenant1/css/site.css" />

Same issue occurs for javascript file and these cannot resolve for the browser.

Any ideas how to solve this?

Thanks!

dotnetron commented 7 years ago

I had to add the line below to Startup.cs in the Configure() method and this appeared to have resolved the issue.

idsvrForTenantApp.UseStaticFiles();

Thanks!