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

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.
 
O

Otis Mukinfus

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
 
Z

Zeya

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top