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 ("Root/Files/../Config/"). 'Config' is a
virtual directory under 'Root' which is also a virtual directory. 'Files' is
a normal folder.

Under IIS 5.0, the path is correctly mapped to the local path of the
'Config' virtual directory.

Under IIS 6.0, the path gets mapped to "C:\WebSite\Root\Files\..\Config",
ignoring the 'Config' virtual directory mapping.

Is there a special setting I should be aware of in IIS 6.0 to ensure correct
mapping of virtual paths?

Many thanks

Elie Grouchko

Re: Server.MapPath() works differently on IIS 6.0 compared to IIS 5.0 by Egbert

Egbert
Sat Jan 01 15:34:50 CST 2005

"Elie Grouchko" <egrouchko@hotmail.com> wrote in message
news:Obup%23OC8EHA.3124@TK2MSFTNGP11.phx.gbl...
> 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 ("Root/Files/../Config/"). 'Config' is a
> virtual directory under 'Root' which is also a virtual directory. 'Files'
> is
> a normal folder.
>
> Under IIS 5.0, the path is correctly mapped to the local path of the
> 'Config' virtual directory.
>
> Under IIS 6.0, the path gets mapped to "C:\WebSite\Root\Files\..\Config",
> ignoring the 'Config' virtual directory mapping.
>
> Is there a special setting I should be aware of in IIS 6.0 to ensure
> correct
> mapping of virtual paths?

I cannot reproduce your settings since a virtual path can be nested and your
IIS config is not quite written down...
note that the IIS docs say that Server.MapPath do not check whether or not a
path exists.

> Many thanks
>
> Elie Grouchko
>
>


Re: Server.MapPath() works differently on IIS 6.0 compared to IIS 5.0 by Elie

Elie
Mon Jan 03 03:59:24 CST 2005

Hi Egbert

I am using the following folder structure:

c:\website\root\files\foo.asp
c:\website\root\configfiles\1\foo.txt

Virtual directories:

The website in IIS is mapped to c:\website

/Root points to c:\website\root
/Root/Config points to c:\website\configfiles\1

In foo.asp there is code that tries to access foo.txt by using
Server.MapPath(/Root/Files/../Config/) to map the file folder.

In IIS 6.0 (Windows SBS 2003):
1. Server.MapPath(/Root/Files/../Config/) returns c:\website\root\config
(wrong)
2. Server.MapPath(/Root/Config/) returns
c:\website\root\configfiles\1 (correct)

In IIS 5.0 (Windows 2000) both return the same correct result (2)

I am now using option 2 so I can continue my work, but I'd like to
understand what's wrong with my original code.

The ParentPath option is set in both IIS 5 and IIS 6

Thanks for your help,

Elie Grouchko

"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:e4iR0oE8EHA.2180@TK2MSFTNGP12.phx.gbl...
> "Elie Grouchko" <egrouchko@hotmail.com> wrote in message
> news:Obup%23OC8EHA.3124@TK2MSFTNGP11.phx.gbl...
>> 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 ("Root/Files/../Config/"). 'Config' is a
>> virtual directory under 'Root' which is also a virtual directory. 'Files'
>> is
>> a normal folder.
>>
>> Under IIS 5.0, the path is correctly mapped to the local path of the
>> 'Config' virtual directory.
>>
>> Under IIS 6.0, the path gets mapped to "C:\WebSite\Root\Files\..\Config",
>> ignoring the 'Config' virtual directory mapping.
>>
>> Is there a special setting I should be aware of in IIS 6.0 to ensure
>> correct
>> mapping of virtual paths?
>
> I cannot reproduce your settings since a virtual path can be nested and
> your IIS config is not quite written down...
> note that the IIS docs say that Server.MapPath do not check whether or not
> a path exists.
>
>> Many thanks
>>
>> Elie Grouchko
>>
>>
>