I have an old Classic ASP application that I want to duplicate in parallel – that is, I want to configure another copy (talking to a different database) alongside the original.
So where I have //MyServer/MyApp1/, I will also soon have //MyServer/MyApp2/… so far so good.
Except that many URLs in the app are absolute (for example JS and CSS files), e.g. <script type="text/javascript" src="/MyApp1/menu.js"></script>.
I could search for references to /MyApp1/ and replace it with /MyApp2/, but it’s an annoying task that I will have to repeat as I update the core application, and in the event of wanting other copies creating – a likelihood albeit temporary.
I could change these URLs to parent paths, but this means I need to refer to each resource differently, depending on where in the application folder structure I am. Again, it would work, but I don’t like using parent paths for a number of reasons.
Given that there is no tilde (~) feature in Classic ASP (to refer to the application root), are there any alternatives that I can consider?
@CJM: I usually have a
db.aspwhich contains thefunctions andsubs that handle opening/closing database connections as the primary include on practically all of my pages. In thisdb.aspI would then define aappurlorabsurlpath which could, in your case, have/MyApp1, and then you can use<script type="text/javascript" src="<%=appurl %>/menu.js"></script>in your scripts.The first time you do it, it’ll be a bit of a search/replace mission, but once it’s done, subsequent “duplicate” projects will just need that one variable updated.