By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Path Problem

P: n/a
I have a web site hosted on a standard commercial ISP. My main web pages are
stored in a "www" directory. Under the www directory I have a folder "net"
defined as a virtual directory for my .NET testing. I also have a directory
"db" as a peer to "www" where users can upload files for processing. My
structure is as follows:

www db
-net

From my aspx page in the "net" directory I want to refer to the "db"
directory but I seem to be stopped from doing so in code? As you can see in
the sample attempts below, I cannot get a path to the "db" directory using
MapPath. If I go up just one level (e.g. "../db") it takes me to "www" and
looks for "db" as a sub of "www", If I try to go up two levels ("../../db")
I get an error?

Path.GetFullPath(Server.MapPath('../db')) is:
C:\inetpub2\resadmin\wengert\wengert.org\www\db

Path.GetFullPath(Server.MapPath('../../db')) is: Causes error - "Cannot use
a leading .. to exit above the top directory."

If I hardcode the real path (e.g.
"C:\inetpub2\resadmin\wengert\wengert.org\db") it works fine.

How can I get a path to the "db" directory based off MapPath?

Wayne
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try ./db

Also, this is a classic ASP group. Look for groups with "dotnet" in their
name.

Bob Lehmann

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...
I have a web site hosted on a standard commercial ISP. My main web pages are stored in a "www" directory. Under the www directory I have a folder "net" defined as a virtual directory for my .NET testing. I also have a directory "db" as a peer to "www" where users can upload files for processing. My
structure is as follows:

www db
-net

From my aspx page in the "net" directory I want to refer to the "db"
directory but I seem to be stopped from doing so in code? As you can see in the sample attempts below, I cannot get a path to the "db" directory using
MapPath. If I go up just one level (e.g. "../db") it takes me to "www" and
looks for "db" as a sub of "www", If I try to go up two levels ("../../db") I get an error?

Path.GetFullPath(Server.MapPath('../db')) is:
C:\inetpub2\resadmin\wengert\wengert.org\www\db

Path.GetFullPath(Server.MapPath('../../db')) is: Causes error - "Cannot use a leading .. to exit above the top directory."

If I hardcode the real path (e.g.
"C:\inetpub2\resadmin\wengert\wengert.org\db") it works fine.

How can I get a path to the "db" directory based off MapPath?

Wayne

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.