• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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