473,403 Members | 2,183 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,403 software developers and data experts.

Server.Mappath returns path on local drive instead of server drive? (ASP.NET)

Jon
I'm calling Server.MapPath from global.asa through this line of code:
Application("reports_dir") = Server.MapPath("Reports")

The web application opens on a testing web server (not mine) at this
mapped drive: M:\

And at this browser URL:
http://mrs2/P2M/login.aspx

I expected MapPath to map a path on the server where the application's
running, in this case the mapped drive M.

However, it returns a path based on my local drive, which is the dev
server but has nothing to do with where the application lives when I'm
running it:

c:\inetpub\wwwroot\p2m\Reports

Can someone explain this? Again, I had expected a M: path, not
anything local and thought that server.mappath had nothing to do with
my local system.

Jon
Nov 17 '05 #1
3 4478
Server.MapPath returns the full PHYSICAL path of the relative path entered.
"Jon" <to****@hotmail.com> wrote in message
news:e4**************************@posting.google.c om...
I'm calling Server.MapPath from global.asa through this line of code:
Application("reports_dir") = Server.MapPath("Reports")

The web application opens on a testing web server (not mine) at this
mapped drive: M:\

And at this browser URL:
http://mrs2/P2M/login.aspx

I expected MapPath to map a path on the server where the application's
running, in this case the mapped drive M.

However, it returns a path based on my local drive, which is the dev
server but has nothing to do with where the application lives when I'm
running it:

c:\inetpub\wwwroot\p2m\Reports

Can someone explain this? Again, I had expected a M: path, not
anything local and thought that server.mappath had nothing to do with
my local system.

Jon

Nov 17 '05 #2
Jon
Scott, I understand your point but it's returning the WRONG physical
path. The application is running on a remote server (M:), and it's
returning a path on my local drive (C:).

"Scott M." <s-***@badspamsnet.net> wrote in message news:<ua**************@TK2MSFTNGP11.phx.gbl>...
Server.MapPath returns the full PHYSICAL path of the relative path entered.
"Jon" <to****@hotmail.com> wrote in message
news:e4**************************@posting.google.c om...
I'm calling Server.MapPath from global.asa through this line of code:
Application("reports_dir") = Server.MapPath("Reports")

The web application opens on a testing web server (not mine) at this
mapped drive: M:\

And at this browser URL:
http://mrs2/P2M/login.aspx

I expected MapPath to map a path on the server where the application's
running, in this case the mapped drive M.

However, it returns a path based on my local drive, which is the dev
server but has nothing to do with where the application lives when I'm
running it:

c:\inetpub\wwwroot\p2m\Reports

Can someone explain this? Again, I had expected a M: path, not
anything local and thought that server.mappath had nothing to do with
my local system.

Jon

Nov 17 '05 #3
What drive is the actual file in question located? Also, you've got just
"Reports" written here. That is the file name you are looking for? No
extension?
"Jon" <to****@hotmail.com> wrote in message
news:e4**************************@posting.google.c om...
Scott, I understand your point but it's returning the WRONG physical
path. The application is running on a remote server (M:), and it's
returning a path on my local drive (C:).

"Scott M." <s-***@badspamsnet.net> wrote in message

news:<ua**************@TK2MSFTNGP11.phx.gbl>...
Server.MapPath returns the full PHYSICAL path of the relative path entered.

"Jon" <to****@hotmail.com> wrote in message
news:e4**************************@posting.google.c om...
I'm calling Server.MapPath from global.asa through this line of code:
Application("reports_dir") = Server.MapPath("Reports")

The web application opens on a testing web server (not mine) at this
mapped drive: M:\

And at this browser URL:
http://mrs2/P2M/login.aspx

I expected MapPath to map a path on the server where the application's
running, in this case the mapped drive M.

However, it returns a path based on my local drive, which is the dev
server but has nothing to do with where the application lives when I'm
running it:

c:\inetpub\wwwroot\p2m\Reports

Can someone explain this? Again, I had expected a M: path, not
anything local and thought that server.mappath had nothing to do with
my local system.

Jon

Nov 17 '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...
7
by: Elie Grouchko | last post by:
Hi I am running exactly the same ASP code on IIS 5.0 and IIS 6.0 I am calling Server.MapPath(), the parameter is a virtual path that includes a reference to a parent path...
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,...
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
19
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However...
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.
3
by: rn5a | last post by:
Server.MapPath returns the physical file path that corresponds to the specified virtual path whereas Request.MapPath maps the specified virtual path to a physical path. Assuming that a file named...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.