Server.MapPath("~")

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

txtUpload1.PostedFile.SaveAs(Server.MapPath("~") + "\\" + file1.Name);

this code loads the file in the root directory of my application, by using
the tilde. How do I accomplish getting the file to loaded above root. My
application is within another applilcation (subdomain). I guess I am looking
the .net equivalent to .. in unix.

Thanks.
 
I could not understand what u mean but i think

Request.PhysicalApplicationPath
Request.PhysicalPath
Request.CurrentExecutionFilePath
Request.ApplicationPath

can help u
 
Hello

System.IO.Path.GetDirectoryName returns the parent directory of a file or
directory.

Best regards,
Sherif
 
James is Right,

..Net will now allow u to access outside from your VD. and i think you are
trying to go one directory up then your root Directory.

Thanks
Ritesh
 
Back
Top