[Mono-aspnet-list] It's Bug? - MapPath method cannot return apache2.2 aliases
grendel at twistedcode.net
Tue May 26 04:55:11 EDT 2009
USAGI at WRP wrote:
> the method is "string System.Web.HttpContext.Current.Server.MapPath(string
> I noticed that the method returned with a false pass on Apache(2.2) +
> mod_mono(2.4) with alias configuration.
> Apache xxxx.conf
> DocumentRoot /var/www
> Alias /hoge /var/hoge
> ASP.NET code
> var physicalPath = HttpContext.Current.Server.MapPath("/hoge")
> The result in this situation becomes the ”/var/www/hoge”. it's not Physical
> Path. it's Virtual Path on the Apache.
> When I tested it in IIS7 with Windows Vista, the method returned truth
> Physical Path. the problem is bug of mono?
The problem is most likely a misconfiguration of your apache virtual host. Mono has no knowledge of
Apache aliases - it is not embedded in Apache, but rather running in a separate process with
mod_mono being the bridge between the two. For MapPath to return the correct path, use the
MonoApplications directive, read documentation at
In the future we'll perhaps make it more seamless, but there are no definite plans as to when the
mod_mono rewrite happens.
> # This trouble is avoidable easy.
> # In substitution for an alias function of Apache, it should make a symbolic
> link. for now.
More information about the Mono-aspnet-list