find root folder path

Posted by RohiK under Regular Expressions on 1/28/2011 | Points: 10 | Views : 5088 | Status : [Member] | Replies : 4
hi ,

suppose I have project on server in tempProject folder in that I have 2 folder img and app.
I have upload my application in app folder and I want path of img folder to access images.
so How could i do this with mappath?

if I wrote Server.Mappath("../../img/") not working

please tell me how to go about that?

Happy Programming!!
Rohi



Responses

Posted by: Karthikanbarasan on: 1/28/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

If your project is in root then u can directly hard code else if its in temp folder then
get it in a string and remove the folder name and add the path as required. this is the straight forward method to do mapping in web servers
To get the path u can use below
HttpContext.Current.Server.MapPath("~/Tempfolder")



Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 1/28/2011 [Member] Starter | Points: 25

Up
0
Down
Hey Karthik ,
my friend I know that. I am asking about if my image folder is on root and my application is in sub folder.
anyway I found it.
I have to write Server.MapPath(../../img)

Thanks!

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/28/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
ok thanks...

Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/29/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi rohik


i think u write this way .. it's working ..


string strPath = Server.MapPath("~/img/");

Best Regard's
Prabhakar

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response