473,320 Members | 1,820 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,320 software developers and data experts.

server.mappath problem.

We have an .asp application , located in:

e:\myapp

In there we have directories like:

e:\myapp\db
e:\myapp\images
e:\myapp\utils
e:\myapp\working

In global.asa we have a server.mappath("db") & "mydb.mdb" to get the db
location

This works MOST of the time, but sometimes the browser shows an error like:

Cant find file e:\myapp\utils\mydb.mdg

This is CLEARLY the wrong file path. Restarting iis or the website or
reinitiallising the application will correct this and it generally works for
a long time and then will do it again, quite randomly. (long time meaning
sometimes months !)

It seems to be a bug of some kind - is anyone aware of this I cannot find
mention of it anywhere.
Nov 30 '05 #1
3 3970
"Cozmo" <co***@cozmos.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
We have an .asp application , located in:

e:\myapp

In there we have directories like:

e:\myapp\db
e:\myapp\images
e:\myapp\utils
e:\myapp\working

In global.asa we have a server.mappath("db") & "mydb.mdb" to get the db
location

This works MOST of the time, but sometimes the browser shows an error like:
Cant find file e:\myapp\utils\mydb.mdg

This is CLEARLY the wrong file path. Restarting iis or the website or
reinitiallising the application will correct this and it generally works for a long time and then will do it again, quite randomly. (long time meaning
sometimes months !)

It seems to be a bug of some kind - is anyone aware of this I cannot find
mention of it anywhere.


You don't understand how to use Server.MapPath().

server.mappath("db") will not do what you think it does.

server.mappath("/db/mydb.mdb") may be what you need.
Nov 30 '05 #2
Actually, I DO understand how it works (aside from the couple of typos in my
post), and it works just fine - about 99.9% of the time.

FYI , as you may not realize the difference, this is the functions method
from M/S:

If Path starts with either a forward (/) or backward slash (\), the MapPath
method returns a path as if Path were a full, virtual path. If Path doesn't
start with a slash, the MapPath method returns a path relative to the
directory of the .asp file being processed.

-- end clip --

I am using a 'relative' path which is necessary as I dont know where my
customers may install the application in relation to the root path or the
root of the website or virtual web - the example you gave is a 'fixed' path
from the root, where the one i showed allows the virtual path to be on the
2nd level of a tree, or the 12th level of the tree ! I cannot use the fixed
path, as I dont have control over where that may be - we may be at the root
or at some subdirectory of the root, perhaps several layers deep !!
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:mM******************************@comcast.com. ..
"Cozmo" <co***@cozmos.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
We have an .asp application , located in:

e:\myapp

In there we have directories like:

e:\myapp\db
e:\myapp\images
e:\myapp\utils
e:\myapp\working

In global.asa we have a server.mappath("db") & "mydb.mdb" to get the db
location

This works MOST of the time, but sometimes the browser shows an error

like:

Cant find file e:\myapp\utils\mydb.mdg

This is CLEARLY the wrong file path. Restarting iis or the website or
reinitiallising the application will correct this and it generally works

for
a long time and then will do it again, quite randomly. (long time meaning
sometimes months !)

It seems to be a bug of some kind - is anyone aware of this I cannot find
mention of it anywhere.


You don't understand how to use Server.MapPath().

server.mappath("db") will not do what you think it does.

server.mappath("/db/mydb.mdb") may be what you need.

Dec 1 '05 #3
"Cozmo" <co***@cozmos.com> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
Actually, I DO understand how it works (aside from the couple of typos in my post), and it works just fine - about 99.9% of the time.

FYI , as you may not realize the difference, this is the functions method
from M/S:

If Path starts with either a forward (/) or backward slash (\), the MapPath method returns a path as if Path were a full, virtual path. If Path doesn't start with a slash, the MapPath method returns a path relative to the
directory of the .asp file being processed.

-- end clip --

I am using a 'relative' path which is necessary as I dont know where my
customers may install the application in relation to the root path or the
root of the website or virtual web - the example you gave is a 'fixed' path from the root, where the one i showed allows the virtual path to be on the
2nd level of a tree, or the 12th level of the tree ! I cannot use the fixed path, as I dont have control over where that may be - we may be at the root or at some subdirectory of the root, perhaps several layers deep !!


[snip]

Try changing:
server.mappath("db") & "mydb.mdb"
to
server.mappath("db/mydb.mdb")
Dec 1 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: John Rebbeck | last post by:
I've got the directory f:\Company\Product set as web shared so it's got a virtual directory in the default web site on my test server's IIS. If I try to use Server.MapPath in that site it returns a...
7
by: A P | last post by:
I receive an error like this: Server.MapPath() error 'ASP 0172 : 80004005' Invalid Path /conn.asp, line 2 The Path parameter for the MapPath method must be a virtual path. A physical path...
4
by: Laphan | last post by:
Hi All Sorry to be irate, but the whole concept of Server.MapPaths really has me in a tiswas!! In order to confirm once and for all, could you please advise me on the following: 1) There...
7
by: laura | last post by:
I'm trying to understand fully Server.MapPath. I am writing an intranet for a small company and want to be able to put some files accessible to all, hyperlinked from the intranet and therefore,...
2
by: Tee | last post by:
Hi, I am currently using Server.MapPath in my aspx files, but because of I am using it more than once, I would like to move these code away from aspx and make it as a public function inside...
6
by: Nathan Sokalski | last post by:
When using the Server.MapPath() method, the results being returned are given as locations on my hard drive. I would like to be returned a result that is a URL, in my case something like the...
7
by: benoit | last post by:
Hi, if I write this code to retrieve a folder on the server Server.mappath("/DATA") I get this error message System.InvalidOperationException: Failed to map the path '/DATA' the virtual...
14
by: Lorenzo | last post by:
Hello, I have a web application with a virtual directory in it. With 'virtual directory' i mean a folder whose physical path is different from the physical path of the application, but in which...
4
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.