How to get virtual path of a folder indepent of where tht folder resides.

  • Thread starter Thread starter pappu
  • Start date Start date
P

pappu

Hello friends,

I have one folder Named as MainFolder on server. I have one more
folder named as subfolder inside tht main folder.Now I want to save
some pictures in tht folder but at runtime I m not getting correct
virtual path of tht folder. As Server.MapPath() & MapPath methods
returns physical path.So How I can Access tht folder independent of
where my application is insatlled.
I have used following metthods but it doesnt work,

Server.MapPath(".//subfolder");
MapPath("~/subfolder");
Request.MapPath(".//subfolder");

Thxxxxxxx,
Sachin.
 
Hello friends,

I have one folder Named as MainFolder on server. I have one more
folder named as subfolder inside tht main folder.Now I want to save
some pictures in tht folder but at runtime I m not getting correct
virtual path of tht folder. As Server.MapPath() & MapPath methods
returns physical path.So How I can Access tht folder independent of
where my application is insatlled.
I have used following metthods but it doesnt work,

Server.MapPath(".//subfolder");
MapPath("~/subfolder");
Request.MapPath(".//subfolder");

Thxxxxxxx,
Sachin.

This is an ASP.NET question.

Please post it at: microsoft.public.dotnet.framework.aspnet

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Server.MapPath has access only inside the context (virtual directory)
otherwise you need to know the exact path. Unless your asp.net thread
is running under a user that can traverse your directory structure.
 
Back
Top