Server.Mappath not finding root properly

Discussion in 'ASP.NET / ASP.NET Core' started by Dewy, Jun 19, 2009.

  1. My code is running in ASP.Net MVC and I have created a custom ActionResult, in it I have the following overload:

    public override void ExecuteResult(ControllerContext context)
    {
    if (!String.IsNullOrEmpty(FileDownloadName))
    {
    context.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=" + FileDownloadName);
    }

    string filePath = context.HttpContext.Server.MapPath(VirtualPath);
    context.HttpContext.Response.TransmitFile(filePath );
    }

    and this is all fine from VS 2008.
    So, I published this only to find that when I try to click the link on the host I get the following:

    Could not find a part of the path 'E:\web\<my discount.asp username>\htdocs\<virtual path>

    (paths missing for security)

    this is very urgent
     
  2. Where is this file? Is it directly under the root or is it inside some subdirectory?
     

Share This Page