Alex Rivera | Logout

Get name of virtual directory?

Asked 2010-01-30T18:43:09.397
17

I'm using Request.ApplicationPath to learn the name of the Virtual Directory in which I'm running. Is there a more reliable way?

Edit
Report

1 Answer

22

Request.ApplicationPath is perfectly reliable way of getting the virtual directory and works always when you have the HttpContext and can ask for the Request data.

For further processing and extracting parts of the path, take a look at the VirtualPathUtility class.

answered 2010-01-30T18:50:02.380

Your Answer