Can anyone explain the difference between Server.MapPath(\".\")
, Server.MapPath(\"~\")
, Server.MapPath(@\"\\\")
and Server.MapPa
Just to expand on @splattne's answer a little:
MapPath(string virtualPath)
calls the following:
public string MapPath(string virtualPath)
{
return this.MapPath(VirtualPath.CreateAllowNull(virtualPath));
}
MapPath(VirtualPath virtualPath)
in turn calls MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, bool allowCrossAppMapping)
which contains the following:
//...
if (virtualPath == null)
{
virtualPath = VirtualPath.Create(".");
}
//...
So if you call MapPath(null)
or MapPath("")
, you are effectively calling MapPath(".")