Thanks for Milosz's input.
Hi Gary,
I agree with Milosz that you're recommended to utilize the "~" symbol of
ASP.NET, Server.MapPath("~/subdir") can give you any subdir's physical path
from your application's root directory. Relative path is not quite safe
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
<mi*****@DONTLIKESPAMwp.pl>
>References: <#g**************@TK2MSFTNGP02.phx.gbl>
Subject: RE: MapPath returning wrong string
Date: Mon, 3 Dec 2007 15:28:03 -0800
>
Hi Gary,
Is there a possibility ThemeManager.cs class was used from a page/user
control inside the AnonymousAccess directory? You should have used :
string DebugString =
System.Web.HttpContext.Current.Server.MapPath(" ~/App_Themes");
Hope it helps
--
Milosz
"GaryDean" wrote:
>The following command...
string DebugString =
System.Web.HttpContext.Current.Server.MapPath("Ap p_Themes");
is executed from my ThemeManager.cs class in my App_code directory
It returns...
"c:\\inetpub\\wwwroot\\TaxBusiness\\AnonymousAcce ss\\App_Themes"
The folders in my website project are...
Admin
AnonymousAccess
App_Code
App_Data
App_Themes
Bin.. etc
MapPath should have returned...
"c:\\inetpub\\wwwroot\\TaxBusiness\\App_Themes "
Why did it stick the extra \\AnonymousAccess directory in there?
App_Themes is a direct child of the TaxBusiness website directory
Thanks
Gary