How can I have a relative path in the web.config file. This value is not in the connection string so I cannot use |DataDirectory| (I think), so what can I do?
+1
A:
What is the relative path for?
Are you talking about a physical directory path or a url path?
Edit:
I needed to do something similar for one of my projects. I needed to locate a config file that was stored in a certain folder. While the web.config file itself does not provide anything special for this, you can take a path from the web.config file and convert it to an app-relative path.
Request.ApplicationPath gets you the base directory of the web application. YOu can append the relative path to this and give it to whatever needs it.
Also see this blog post by Rick Strahl for other interesting directories that may help you.
You could then append the relatvie path to
Gilligan
2008-09-22 03:08:52
I want to use the equivalent of ~/App_Data/Foobar.xml on whatever box I load it onto.
Dested
2008-09-22 03:10:42