Server.MapPath not working anymore

Discussion in 'ASP.NET / ASP.NET Core' started by philbags, Oct 30, 2011.

  1. Hi All,

    I have an image uploader class which was working just fine until a short while ago.

    ...
    Dim filePath As String = "~/images/client-images/" & upName & Left(str.ToString, 6) & ".png"

    newBmp.Save(HttpContext.Current.Server.MapPath(filePath), Imaging.ImageFormat.Png)


    A little debugging discovered a Generic error occurred in GDI +.

    It seems server.mappath is returning

    E:\web\allaboutsta\htdocs\MarketPlace\images\client-images\Image09220cfb6.png

    for my image. This seems to be the right location to save my file but it's not working! Any Ideas?

    BTW. I also have an ASP.NET 4 application using the same uploader with the same code on a different DASP server which is still OK and both apps are working fine locally too.
     
  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    The GDI+ error can be misleading. Try checking the user quota usage in the Control Panel as it appears you are trying to save a file.
     
  3. Out of disk space on this account perhaps? Post the actual exception being thrown if you can.
     
  4. Great minds think alike :)
     
  5. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    ;) I took a quick look at your account. Increasing the quota for the Anonymous ASPNet User will solve the problem.
     
  6. Thanks guys. It was the user quota. Problem solved!
     

Share This Page