Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to manage paths on the server 1

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
US
I am having difficulty loading XML files on the server in my global.asax file:
[tt]
dataSet.ReadXML(??????)
[/tt]
The problem is, I don't know what the path is when I use a web hosting service.

First of all, should I use a relative address? I tried that with unreliable success, after all, is the path relative to the global.asax file or to the page that just happens to trip the global.asax file whether that be the homepage or any page that the user has in his favorites?

Also, do I use the web address like or the server (I would call it hardware) address like C:\Inetpub\MyApp?

I know of the Server.MapPath function but again, if I use relative addressing, what is it relative too? ex: Server.MapPath(".") will return what relative to the dll running the code (this will be the bin folder)? Relative to the page the code is in? Relative to global.asax? Relative to the homepage?

What I would really like to do is just embed the XML file into the the project assembly, but I don't know how to reference it once that happens.

But what I will do is what the best thing is to do. Thanks for any help!
 
It's relative to wherever the calling page is that's using server.mappath()

if you wanna go one level up from the current page, and drill down into a folder on that level called xml, then just:

server.mappath("../xml/")

will return to you the full path, ie:

d:\or whatever.
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top