By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,775 Members | 1,353 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,775 IT Pros & Developers. It's quick & easy.

Web root directory

P: n/a
Hi all,
i'm trying to write a piece of code using c# that will return the
physical location of the web root directory.

Actually, i was able to retrieve the list of available virtual
directories on my localhost using System.DirectoryServices but all the
paths i get are vurtual ones, but i want their actual or physical
location, so i thought of getting the web root folder and then mapping
the virtual path of all other folders to it

i'm using c#, VS2003 and IIS 6.0

any ideas :D

thanx for ur quick reply

Jan 28 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

xxxx wrote:
Hi all,
i'm trying to write a piece of code using c# that will return the
physical location of the web root directory.

Actually, i was able to retrieve the list of available virtual
directories on my localhost using System.DirectoryServices but all the
paths i get are vurtual ones, but i want their actual or physical
location, so i thought of getting the web root folder and then mapping
the virtual path of all other folders to it

i'm using c#, VS2003 and IIS 6.0

any ideas :D

thanx for ur quick reply
I think that this does what you want:

string strPath = this.Request.MapPath( "/" );

Does it?

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 28 '07 #2

P: n/a

actually i'm building a desktop applicatio not a web appliaction

On Jan 28, 9:21 pm, "Laurent Bugnion [MVP]" <galasoft...@bluewin.ch>
wrote:
Hi,

xxxx wrote:
Hi all,
i'm trying to write a piece of code using c# that will return the
physical location of the web root directory.
Actually, i was able to retrieve the list of available virtual
directories on my localhost using System.DirectoryServices but all the
paths i get are vurtual ones, but i want their actual or physical
location, so i thought of getting the web root folder and then mapping
the virtual path of all other folders to it
i'm using c#, VS2003 and IIS 6.0
any ideas :D
thanx for ur quick replyI think that this does what you want:

string strPath = this.Request.MapPath( "/" );

Does it?

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering:http://www.galasoft-LB.ch
PhotoAlbum:http://www.galasoft-LB.ch/pictures
Support children in Calcutta:http://www.calcutta-espoir.ch- Hide quoted text -- Show quoted text -
Jan 30 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.