server.mappath and the non-browseable root folder

yorri

Perch
Does anyone know if it is possible to use the Server.Mappath method to retrieve the path of a file that is in our root directory..the directory that is above our domain website files?

I know I could use an absolute path but wondered if Server.MapPath could be used?

Thanks in advance.
 
of course. Server.MapPath("../mydatabase.db") is commonly used by our customers to retrieve a file in the root directory
 
Yash said:
of course. Server.MapPath("../mydatabase.db") is commonly used by our customers to retrieve a file in the root directory

Great...I wasn't sure if it would work beyond the root of the website itself...I guess I am/was restricting Server.MapPath to the path of the website only in my head.

I am glad to hear it will work.

Thanks.
 
yorri said:
I guess I am/was restricting Server.MapPath to the path of the website only in my head.
Not exactly. By default it is restricted, but you can (and should) ask support (Yash for example :) ) to enable parent paths. This is what I did. Of course if it doesn't enabled already :)
 
What I was meaning is that I thought server.mappath would only return a path if it resided within the path of the website. That is what I meant by restricting in my head. I didn't think about it too much as I just started using this method and I as a rule try not to assume anything. It is frustrating sometimes because people will say to me "DUH!" but at the same time it prevents me from assuming a false truth which will get me in trouble (now I am talking about life in general ;))..anyway...

Parent paths are enabled but I have yet to try it out...I am just so happy I can do this.

Thanks for your thoughts St.Patrick
 
Back
Top