473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Path Problem

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
1 1493
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
1
by: bob | last post by:
I have created a simple Windows service in VB.Net which installs fine using InstallUtil.exe to install it to, for example "c:\test", or "c:\Windows\YellowBanana", but if I install it to "c:\Program...
5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
12
by: Xah Lee | last post by:
Python Doc Problem Example Quote from: http://docs.python.org/lib/module-os.path.html ---------- split( path) Split the pathname path into a pair, (head, tail) where tail is the last...
13
by: Adam | last post by:
Trying to get an asp.net 2.0 app running and am receiving this error. I see a bunch of people with this error on the net, but no solution: Works fine on my local machine, deployed to a server it...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
10
by: wo_shi_big_stomach | last post by:
Newbie to python writing a script to recurse a directory tree and delete the first line of a file if it contains a given string. I get the same error on a Mac running OS X 10.4.8 and FreeBSD 6.1. ...
34
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH...
2
by: contractsup | last post by:
Environment: $ uname -a AIX <withheld2 5 000100614C00 $ db2level DB21085I Instance "<withheld>" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106"....
5
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
Before you respond with "just use GetShortPathName" please read the rest. We have an application that places files on a file server using mapped drives as it's path of choice. The reason for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.