ISP path to web site files contains IP address causing an error. Please help

  • Thread starter Thread starter keith
  • Start date Start date
K

keith

Running on localhost, the code,
'DirectoryInfo d = new
DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath("~/Upload"));'
sets d to the value "c:\happyzoomer\upload"

When the application runs under a web hosting account, it sets d to:
'D:\websites\69.20.101.123\happyzoomer.com\Upload'. and throws the following
error: System.IO.DirectoryNotFoundException: Could not find a part of the
path 'D:\websites\69.20.101.123\happyzoomer.com\Upload'.

I think that the ip address in the path may be the cause of the error.
Either that or perhaps it is a permissions issue. I'm kind of new to web
hosting issues. Can someone suggest an alternate way of coding this?

Thanks,

Keith
 
Try some of the other provided path - mapping methods such as those on the
Request object , e.g., Request.PhysicalApplicationPath etc.
Some of these may give you actual physical directory paths. Otherwise, you
will still need to deal with permissions issues.
Peter
 
Back
Top