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 7 3669
Elie Grouchko wrote on 01 jan 2005 in
microsoft.public.inetserver.asp.general: 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
Server.MapPath("Root/Files/../Config/")
Try:
Server.MapPath("/Root/Files/../Config/")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
On Sat, 1 Jan 2005 19:02:44 +0200, "Elie Grouchko"
<eg*******@hotmail.com> wrote: 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?
Shouldn't that be Server.MapPath("/Config") ? It's a virtual folder
under the root, if you wanted to get to the folder in a url you'd use
http://{host}.{Domain}.{TLD}/Config/ so that's where the MapPath
should point.
Jeff
Hi Jeff
Sorry for the typo error
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
"Jeff Cochran" <je*********@zina.com> wrote in message
news:41***************@msnews.microsoft.com... On Sat, 1 Jan 2005 19:02:44 +0200, "Elie Grouchko" <eg*******@hotmail.com> wrote:
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?
Shouldn't that be Server.MapPath("/Config") ? It's a virtual folder under the root, if you wanted to get to the folder in a url you'd use http://{host}.{Domain}.{TLD}/Config/ so that's where the MapPath should point.
Jeff
Elie Grouchko wrote on 03 jan 2005 in
microsoft.public.inetserver.asp.general: In foo.asp there is code that tries to access foo.txt by using Server.MapPath(/Root/Files/../Config/) to map the file folder.
This does not work, Elie.
Server.MapPath() needs a string argument
and /Root/Files/../Config/ will not evaluate to a string.
result = Server.MapPath("/Root/Files/../Config/")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Since you say you have parentpaths enabled in both versions I suspect that
it is a security change. You always know the site-relative path to the
config directory so just use "/root/config/"
--
Mark Schupp
Head of Development
Integrity eLearning www.ielearning.com
"Elie Grouchko" <eg*******@hotmail.com> wrote in message
news:em**************@TK2MSFTNGP12.phx.gbl... Hi Jeff
Sorry for the typo error
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 "Jeff Cochran" <je*********@zina.com> wrote in message news:41***************@msnews.microsoft.com... On Sat, 1 Jan 2005 19:02:44 +0200, "Elie Grouchko" <eg*******@hotmail.com> wrote:
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?
Shouldn't that be Server.MapPath("/Config") ? It's a virtual folder under the root, if you wanted to get to the folder in a url you'd use http://{host}.{Domain}.{TLD}/Config/ so that's where the MapPath should point.
Jeff
On Mon, 3 Jan 2005 12:04:28 +0200, "Elie Grouchko"
<eg*******@hotmail.com> wrote: Hi Jeff
Sorry for the typo error
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)
Well, that's exactly where it should go. From the website it goes to
root, then down to files, then back up to root, then down to config.
2. Server.MapPath(/Root/Config/) returns c:\website\root\configfiles\1 (correct)
That's where it should go as well, to the virtual folder.
Your issue is traversing files, which has changed. You can't traverse
down then back up then into a virtual folder as before. And there was
a file traversal security fix for w2K that should have prevented this
in IIS5, as would using the IIS Lockdown Tool.
Jeff
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 "Jeff Cochran" <je*********@zina.com> wrote in message news:41***************@msnews.microsoft.com... On Sat, 1 Jan 2005 19:02:44 +0200, "Elie Grouchko" <eg*******@hotmail.com> wrote:
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?
Shouldn't that be Server.MapPath("/Config") ? It's a virtual folder under the root, if you wanted to get to the folder in a url you'd use http://{host}.{Domain}.{TLD}/Config/ so that's where the MapPath should point.
Jeff
I didn't think about security issues, it does make sense now.
Thanks for your help
Elie Grouchko
"Jeff Cochran" <je*********@zina.com> wrote in message
news:41****************@msnews.microsoft.com... On Mon, 3 Jan 2005 12:04:28 +0200, "Elie Grouchko" <eg*******@hotmail.com> wrote:
Hi Jeff
Sorry for the typo error
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)
Well, that's exactly where it should go. From the website it goes to root, then down to files, then back up to root, then down to config.
2. Server.MapPath(/Root/Config/) returns c:\website\root\configfiles\1 (correct)
That's where it should go as well, to the virtual folder.
Your issue is traversing files, which has changed. You can't traverse down then back up then into a virtual folder as before. And there was a file traversal security fix for w2K that should have prevented this in IIS5, as would using the IIS Lockdown Tool.
Jeff
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 "Jeff Cochran" <je*********@zina.com> wrote in message news:41***************@msnews.microsoft.com... On Sat, 1 Jan 2005 19:02:44 +0200, "Elie Grouchko" <eg*******@hotmail.com> wrote:
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?
Shouldn't that be Server.MapPath("/Config") ? It's a virtual folder under the root, if you wanted to get to the folder in a url you'd use http://{host}.{Domain}.{TLD}/Config/ so that's where the MapPath should point.
Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Bon |
last post by:
Hello all
Would it be possible to migrate the MS Access 2000 to MS SQL Server
2000?
My application is using MS Access 2000 as database and as user
interface such as forms. Now, I want to...
|
by: Peter Row |
last post by:
Hi,
BACKGROUND:
Win2K Server SP4, ASP.NET 1.1
Win2K Pro SP4, ASP.NET 1.1
I have a wrapper class around all the asp objects.
Website physical directory structure (phoney names)
Server:...
|
by: Peter Row |
last post by:
Hi,
BACKGROUND:
Win2K Server SP4, ASP.NET 1.1
Win2K Pro SP4, ASP.NET 1.1
I have a wrapper class around all the asp objects.
Website physical directory structure (phoney names)
Server:...
|
by: Cozmo |
last post by:
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
|
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...
|
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...
|
by: teo |
last post by:
I need to use the 'Server.MapPath' function
in the 'Session_End' event of the Global.asax file
(to reach a folder and the clean some temporary files up),
but it doesn't work:
Sub...
|
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>")...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
| |