I have a foler called A and inside A, i have 2 folders B and C, B is having a child folder called child B,now i have a program in C .from C I need to get the PHysical path of childB When i am giving Server.MapPath("../B/childB/") It is showing.Error.Can anybody tell me how to solve this ?
For security reasons, MapPath
won't resolve paths outside the current application.
Since you know the actual structure why not get the current path to childB and than just use Path.Combine for the rest?
Is there an actual reason you want it in one go using relative paths?
Another point - the B folder may not be defined in IIS and so relativity may not work...
Doesn't seem like you're doing anything wrong with the actual function. Relative paths are supported, as described in the reading below. Hard to say without more info, but does your folder exist in your solution?
You can also, as mentioned, use absolute paths (/B/childB).
MSDN http://msdn.microsoft.com/en-us/library/ms524632.aspx
4GuyFromRolla http://www.4guysfromrolla.com/webtech/121799-1.shtml