[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Point xmldoc.load to a root file when it is being called be a virtual directory tag within a subfolder

Hi, I have an IIS server with a universal web.config for connection strings.  i have older classic asp files I wrote a script for to parse the web.config file.  I want both the connection.asp and the web.config to sit on the root level.

I successfully connect to the connection .asp at the root level using this tag within the classic asp pages  <!--#include virtual="/ClientConnection.asp"-->

But when it reads this file, it will only connect to a web.config file within the folder, not at the root - this is the code that loads the web.config

xmlDoc.Load(Server.Mappath("web.config"))

Can I make this to force it to point to a root file?
0
theclassic
Asked:
theclassic
  • 2
1 Solution
 
ChizlCommented:
xmlDoc.Load(Request.ServerVariables("APPL_PHYSICAL_PATH") & "web.config")

Server.Mappath means current folder..   As long as you left everything default in IIS, then the application physical path will be the root of the website.
0
 
ChizlCommented:
Here I setup an example..   Look how the APPL_PHYSICAL_PATH is the same, but the PATH_TRANSLATED is different..

http://www.chizl.com/vars.asp
http://www.chizl.com/chizl/vars.asp
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now