473,597 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.MapPath( ) localhost

If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).

If I run Server.MapPath( "/") on my intranet server, my localhost, I
get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
are in c:\webtest.

How to I establish the correct physical root on my intranet server?

Thanking you in anticipation.

Feb 26 '08 #1
6 7932

Uzytkownik "withers" <ro***@upperbri dge.co.uknapisa l w wiadomosci
news:e0******** *************** ***********@34g 2000hsz.googleg roups.com...
If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).

If I run Server.MapPath( "/") on my intranet server, my localhost, I
get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
are in c:\webtest.

How to I establish the correct physical root on my intranet server?
c:\inetpub\wwwr oot is probably correct physical path in that case. Check in
your IIS configuration console what exactly indicates wwwroot path and
change to proper if need.
--
td
Feb 26 '08 #2
On Feb 26, 8:13*am, "TOUDIdel" <toudi...@oDWA. plwrote:
Uzytkownik "withers" <ro...@upperbri dge.co.uknapisa l w wiadomoscinews: e0************* *************** ******@34g2000h sz.googlegroups .com...
If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).
If I run Server.MapPath( "/") on my intranet server, my localhost, I
get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
are in c:\webtest.
How to I establish the correct physical root on my intranet server?

c:\inetpub\wwwr oot is probably correct physical path in that case. Check in
your IIS configuration console what exactly indicates wwwroot path and
change to proper if need.
--
td
All my websites are in a folder c:\WebTest on my local host. For
example, the files for Web1.com are in c:\WebTest\Web1 .com.

If I look at the properties of Web1.com, on the Home Directory tab the
local path is set to c:\WebTexs\Web1 .com.

If I run Server.MapPath( "/") from a page in Web1.com, the result is c:
\inetpub\wwwroo t.

In IIS, all the virtual directories are in a folder Default Web Site.
The properties of this show a local path of c:\inetpub\wwwr oot.
Server.MapPath( "/") will always resolve to the local path I set in
Default Web Site properties.

I want Server.MapPath( "/") to resolve to the website that runs this
command, in my example, resolve to c:\WebTest\Web1 .com.

How do I set up IIS so that Server.MapPath uses the local path of the
website rather than the local path of the Default Web Site
properities?

I have noticed on my operation server in the internet, the local path
setting in Default Web Site properties is greyed out. Server.MapPath
gives the correct answer on this server.

Thanking you in anticipation.
Feb 26 '08 #3
"withers" <ro***@upperbri dge.co.ukwrote in message
news:e0******** *************** ***********@34g 2000hsz.googleg roups.com...
If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).

If I run Server.MapPath( "/") on my intranet server, my localhost, I
get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
are in c:\webtest.

How to I establish the correct physical root on my intranet server?

Your local host is XP? Do really have multiple websites on the local host
or do you in fact simply have one the Default Web Site under which you've
created one or more virtual directories enabled as applications?

I think what you really need is this:-

sPath = Request.ServerV ariables("APPL_ PHYSICAL_PATH")
--
Anthony Jones - MVP ASP/ASP.NET
Feb 26 '08 #4
withers wrote on Mon, 25 Feb 2008 16:17:53 -0800 (PST):
If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).
If I run Server.MapPath( "/") on my intranet server, my localhost, I get
c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they are in
c:\webtest.
How to I establish the correct physical root on my intranet server?
Thanking you in anticipation.

Server.MapPath( "/") returns the physical root for the site. If you need the
physical location for a virtual dir, try Server.MapPath( "./") instead.

--
Dan
Feb 26 '08 #5
On Feb 26, 12:55*pm, "Daniel Crichton" <msn...@worldof spack.com>
wrote:
withers wrote *on Mon, 25 Feb 2008 16:17:53 -0800 (PST):
If I run Server.MapPath( "/") on my operational Internet server I get,
correctly, the physical path to the directory my page is in (d:\....
\...\htdocs).
If I run Server.MapPath( "/") on my intranet server, my localhost, I get
c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they are in
c:\webtest.
How to I establish the correct physical root on my intranet server?
Thanking you in anticipation.

Server.MapPath( "/") returns the physical root for the site. If you need the
physical location for a virtual dir, try Server.MapPath( "./") instead.

--
Dan
Many thanks for your help, Anthony and Dan.

Spoilt for choice! Request.ServerV ariables("APPL_ PHYSICAL_PATH") or
Server.MapPath( "./").

Does it matter which I use?
Feb 26 '08 #6
"withers" <ro***@upperbri dge.co.ukwrote in message
news:eb******** *************** ***********@e23 g2000prf.google groups.com...
On Feb 26, 12:55 pm, "Daniel Crichton" <msn...@worldof spack.com>
wrote:
withers wrote on Mon, 25 Feb 2008 16:17:53 -0800 (PST):

Many thanks for your help, Anthony and Dan.

Spoilt for choice! Request.ServerV ariables("APPL_ PHYSICAL_PATH") or
Server.MapPath ("./").

Does it matter which I use?
I haven't actually tested it but it seems to me that Server.MapPath( "./")
will return the physical folder that the current ASP page is found in. This
is not necesarily the same as the application physical path. If the page
executing the code is in a sub-folder with in the application folder the two
will return different results. So it depends on what you really want. The
current folder the ASP pages is running in or the root folder of the
application.

--
Anthony Jones - MVP ASP/ASP.NET
Feb 26 '08 #7

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

Similar topics

0
1065
by: Steve | last post by:
When the web site is not setup as the default then MapPath("virtname") returns the correct physical path for a virtual directory which has been setup. However, when the web site is setup as the default web site then MapPath("virtname") doesn't return the correct physical path. For example, http://localhost/mws/default.aspx MapPath("virtdir") in this instance correctly returns "C:\mws\data"
2
1453
by: Jim Heavey | last post by:
I am trying to set up the "path" for were my Access Database is on my Webhost provideer. When I set up my FTP account, it indicated that my physical path was "E:\www.MyWebsite.com". When I asked my webhost if I could use this as my physical address, they indicated that I should create a directory under the root and place my access database there and the use the "Server.MetPath(string)" to retrieve the path. My question is what value...
10
9018
by: Kenneth P | last post by:
Hi all, I have an Access database and try to create a connection to it using the Server.MapPath method. I have the app lib in c:\inetprub\wwwroot\apps\myApp and the database in c:\inetpub\dbq\myDB. Using Server.MapPath("../../../dbq/myDB") should as I understand it take me to the myDB lib. But instead I get an error message saying "Cannot use a leading .. to exit above the top directory."
6
3860
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 following: http://localhost/WebApplication1/WebForm1.aspx Instead, I am recieving results that are something like the following: c:/inetpub/wwwroot/WebApplication1/WebForm1.aspx
19
10193
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 when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
7
3383
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 folder for my webApp is not situated in Inetpub, nor is the DATA folder that I would like to retrieve
14
12709
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 Web Sharing is active. For example: my application is in "C:\Inetpub\wwwroot\MyApp", the Virtual folder is in "C:\VirtualFolder", and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
1
4302
by: Lyners | last post by:
Hello all, I have created an ASP.NET website that uses Crystal Reports that works on the localhost (my PC), but when I copy it to the server it does not. The problem is ExcelUseConstantColumnWidth = False. On my PC when exporting a report, it works - columns are varible width to fit the field, from the server it does not - I get constant width columns. I suspect it is a DLL issue, but so far all my comparisons are coming out the same.
5
9618
by: MichiMichi | last post by:
When using Server.MapPath on IIS 5 on my localhost everything works well. All of the following commands are executed without any error Response.Write(Server.MapPath("/app_test") & "<br>") Response.Write(Server.MapPath("app_test") & "<br>") Response.Write(Server.MapPath("~") & "<br>") However, running the first statement on via the internal Visual Studio 2005 Server I receive an error for
0
7883
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6677
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5842
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5421
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3876
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3917
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.