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\wwwroot, 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.

Re: Server.MapPath() localhost by TOUDIdel

TOUDIdel
Tue Feb 26 02:13:42 CST 2008


Uzytkownik "withers" <roger@upperbridge.co.uk> napisal w wiadomosci
news:e0fbaa25-cdf6-44e4-aa0e-f18218b83305@34g2000hsz.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\wwwroot, 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\wwwroot 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



Re: Server.MapPath() localhost by withers

withers
Tue Feb 26 04:40:28 CST 2008

On Feb 26, 8:13=A0am, "TOUDIdel" <toudi...@oDWA.pl> wrote:
> Uzytkownik "withers" <ro...@upperbridge.co.uk> napisal w wiadomoscinews:e0=
fbaa25-cdf6-44e4-aa0e-f18218b83305@34g2000hsz.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\wwwroot, 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\wwwroot is probably correct physical path in that case. Check i=
n
> 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\wwwroot.

In IIS, all the virtual directories are in a folder Default Web Site.
The properties of this show a local path of c:\inetpub\wwwroot.
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.

Re: Server.MapPath() localhost by Anthony

Anthony
Tue Feb 26 05:38:33 CST 2008

"withers" <roger@upperbridge.co.uk> wrote in message
news:e0fbaa25-cdf6-44e4-aa0e-f18218b83305@34g2000hsz.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\wwwroot, 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.ServerVariables("APPL_PHYSICAL_PATH")


--
Anthony Jones - MVP ASP/ASP.NET



Re: Server.MapPath() localhost by Daniel

Daniel
Tue Feb 26 06:55:41 CST 2008

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\wwwroot, 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



Re: Server.MapPath() localhost by withers

withers
Tue Feb 26 09:15:40 CST 2008

On Feb 26, 12:55=A0pm, "Daniel Crichton" <msn...@worldofspack.com>
wrote:
> withers wrote =A0on 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\wwwroot, 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 th=
e
> physical location for a virtual dir, try Server.MapPath("./") instead.
>
> --
> Dan

Many thanks for your help, Anthony and Dan.

Spoilt for choice! Request.ServerVariables("APPL_PHYSICAL_PATH") or
Server.MapPath("./").

Does it matter which I use?

Re: Server.MapPath() localhost by Anthony

Anthony
Tue Feb 26 11:58:41 CST 2008

"withers" <roger@upperbridge.co.uk> wrote in message
news:eba7fa51-ad03-4935-9d0a-991ec4570140@e23g2000prf.googlegroups.com...
On Feb 26, 12:55 pm, "Daniel Crichton" <msn...@worldofspack.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.ServerVariables("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