Reputation: 36171
I'm working on an multi tenant app, so I have a lot of dynamic subdomains:
user1.example.com user2.example.com
etc
It works great, but there's one problem though. Images are not displayed.
<img src="/images/logo.png" />
Will display on example.com, but it won't work on user1.example.com
I can of course use the following solution:
<img src="http://example.com/images/logo.png" />
But I want to have something more elegant if that's possible.
Upvotes: 0
Views: 634
Reputation: 3338
If the images are common, why don't you host them on a sperate subdomain such as static.example.com. This will help performance too as the images will be cached if people use applications on multiple subdomains. Putting other static content there, such as common javascript files, will aid performance too.
You can also create a custom HTML Helper to output the static URL for the image.
Upvotes: 3
Reputation: 5252
Have you tried using something like: <img src="<%=Url.Content("~/")%>images/logo.png" />
Upvotes: 0