Here's the situation. I have no idea if this is a config and deployment problem, but that's my best guess since it happens in a particular IIS instance and not elsewhere.
My company has a public website http://www.foo.com and a members' websitehttps://secure.foo.com, which is an asp.net forms application with SSL required. For testing, we have some internal hosts which (inside our firewall) are accessible with names such ashttps://test1.secure.foo.com. That app has a master page which has a user control which has asp:ImageButton buttons, and those ImageButtons haveImageUrl attributes which are assigned URLs that start with a tilde. For example:
<asp:ImageButton ID="imgbtnAbout" runat="server" ImageUrl="~/images/nav/nav_about.png" CausesValidation="false" />
Normally, this works fine. The tilde gets translated into an absolute URL that matches the host site.
But on one internal server, the tilde is being translated wrong. The host IIS server for this test instance has got more than one website on it, and two of them are, we'll say,test1.secure.foo.com and test2.secure.foo.com, both of which require SSL. What we were seeing today was that you could browse to a page on thetest1 server, and the images would show as failed X's, and when you checked what URL they were being rendered as, it washttp://test2.secure.foo.com/images/nav/nav_about.png.
HOW ON EARTH COULD A TILDE ON THE test1 WEBSITE RESOLVE INTO A URL THAT STARTS WITHtest2 ?????
We redeployed the application, and the test2.secure.foo.com changed back totest1.secure.foo.com ...but it didn't fix the site, the images were still broken, because the image URLs started with http:// instead of https://. All of the requests were tohttps://test1.secure.foo.com ...so how could the tilde be resolving intohttp://test1.secure.foo.com, with no https? The result is that the images are still error X's.
How is it possible for the translation of app-relative tilde paths to go so wrong? We use tildes extensively in the app, and they've always behaved until now... are we going to have to stop using tildes?