Microsoft KB Archive/290292

= BUG: WinCE ASP Server.MapPath Method Behaves Differently than IIS Server.MapPath =

Article ID: 290292

Article Last Modified on 12/26/2003

-

APPLIES TO


 * Microsoft Windows CE 3.0 for the Handheld PC

-



This article was previously published under Q290292



SYMPTOMS
The Server.MapPath method in an Active Server Pages (ASP) page executed under the Web server on Windows CE returns a different path than when the same ASP code is executed in an ASP page under Internet Information Server (IIS). Specifically, if the argument passed to MapPath does not begin with &quot;/&quot;, ASP returns a path that is relative to the virtual root folder, not the current virtual path of where this ASP page is located. This may be a problem when you are adapting ASP pages designed for IIS to work on Windows CE.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The Server.MapPath method is available to scripts running in ASP pages. It is used to translate a virtual path into its corresponding physical path in the Web server virtual root table.

Steps to Reproduce Behavior
Create a virtual folder named &quot;/Test&quot; on Windows CE and map it to &quot;\Testdir&quot;. To do this, add the following entry to the SERVERS.REG file:

[HKEY_LOCAL_MACHINE\COMM\HTTPD\VROOTS\/Test] (default)=&quot;\testdir&quot;

[HKEY_LOCAL_MACHINE\COMM\HTTPD\VROOTS\/] (default)=&quot;\window\www\wwwpub&quot;
 * root directory, included in image by default configurations

Use the following ASP code to create \Testdir\Test.asp, and then access http:///Test/Test.asp in a Web browser. <%= Server.MapPath(&quot;mypage.htm&quot;) %>;

The returned text will read &quot;\windows\www\wwwpub\mypage.htm&quot; because Test.htm was assumed to be in the &quot;/&quot; virtual folder. IIS, under similar virtual root configuration, would return the string &quot;\testdir\mypage.htm&quot; because Test.asp is in the &quot;/Test&quot; virtual root.

To work around this behavior, the entire virtual root must be included in the Server.MapPath string. To get the virtual root of &quot;/Test&quot; in this example, the following ASP script would be required: <%= Server.MapPath(&quot;/Test/mypage.htm&quot;) %>

Additional query words: wrong broken bug path

Keywords: kbbug kbpending KB290292

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.