finding location of root web directory

O

Oliver

hi all..

Is there a way I can find out the location on disk of my root web
directory.

Typically this will be C:\Inetpub\wwwroot.

I am *not* running a web application under IIS when I need this info
(actually it's part of a unit test).

ta very much,
Oli.
 
J

Jeffrey Palermo [MCP]

Oliver,
Typically,
HttpContext.Current.Server.MapPath("~/");
Will do the trick.

Best regards,
Jeffrey Palermo
 
O

Oliver

Oliver,
Typically,
HttpContext.Current.Server.MapPath("~/");
Will do the trick.


grrr.. no - I'm *not* running ASP.NET under IIS - hence have no HTTPContext.
I'm running a unit test app. under windows.

thanks anyway,
Oli.
 
J

Jeffrey Palermo [MCP]

Oliver,
I understand now that you are not running this in a web context, so I'm
curious to know how you are getting your ASPX pages to work. Or maybe you
are testing some logic classes that need to know the root directory? If
there is no HttpContext, you won't be able to infer the root directory
because this is dependent on th HttpContext. For you testing purposes, I'm
afraid you'll have to hard-code it or make it a configuration item.

Does this address your question? If not, I'd like to help if you can be
more specific.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top