Finding out your web application’s path seems to cause a little confusion.
A good place to start is this MSDN article. The HttpRequest object that contains all these paths is available via the HttpApplication, HttpContext, Page, and UserControl classes.
For example, to get the physical location of the Web Application you could do the following:
HttpRequest request = HttpContext.Current.Request;
string applicationRoot = request.PhysicalApplicationPath;
If you need to extract a particular part of a path, then you probably want to use the System.IO.Path member functions.
No comments:
Post a Comment