|
Is there a way to change or specify how virtual paths are resolved?
I'm creating a site on my machine, but for purposes of demonstration, I want to deploy it to a sub folder of an existing web site. So, on the web host, I have
wwwroot (which is the parent site)
wwwroot/demosite (which is the demo web site)
Of course, this means that a virtual path of "~/demosite.master" ain't gonna work, because that would resolve to "/demosite.master" instead of the desired "/demosite/demosite.master".
I tried using inline code, but of course that isn't allowed (some far-sighted MSoftie probably knew I was going to need to do this, and this is some sort of weird personal vendetta to prevent me from actually getting anything done).
What I want to do is to make the code change the various virtual paths used throughout the demosite, so that I don't have to remember to do it when I deploy to it's actual production server.
So, for localhost (when developing) and deployment onto the actual production server, I want to use the current virtual path, but for the demo version, I need to change the virtual path root.
Is that possible, and if so, how?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
When you deploy the site, you need to make sure that the "demosite" folder is an application. In IIS Manager, right-click on the folder and select "Convert to Application". Your app-relative paths (~/demosite.master ) will then resolve to the correct path.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm not sure I can change that, since the deployment is to a web host.
I was actually hoping for a web.config approach, or some other technique.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I am not sure if this trick may work for you, but you can create one section in configuration file indicating if you are running site for production or for testing.
if you config section says isTestMode="true" it means for testing otherwise production.
you need to add condition on every location that may be for one time. hope this may help you.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|