Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to get phisical path (required_folder) to virtual folder? Current folder and required_folder are phisical pathes of different root virtual folders; folder and required_folder are in the same root phisical folder.
The next code didn't help:
C#
string folder = Server.MapPath(""); // get current folder
folder = folder.Substring(0, folder.LastIndexOf('\\') + 1) + "required_folder"; // get required folder
Posted
Updated 1-Dec-11 0:34am
v4

Assuming that required_folder is part of the current web application path,
C#
string folder = Server.MapPath("~/required_folder/");

will return the physical path of the required_folder folder.
 
Share this answer
 
Comments
Maks1004 1-Dec-11 3:55am    
Sorry for mistake in formulation, I mean some another: current folder and required_folder are phisical pathes of different root virtual folders; folder and required_folder are in the same root phisical folder.

Thanks.
try this

C#
string req_folder= Server.MapPath("~/required_folder/");


thanks
 
Share this answer
 
Comments
Maks1004 1-Dec-11 3:56am    
Sorry for mistake in formulation, I mean some another: current folder and required_folder are phisical pathes of different root virtual folders; folder and required_folder are in the same root phisical folder.

Thanks.
I had no permissions to read and to write to required_folder (problems with hosting). Now I have permissions and all is OK.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900