"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:u0**************@tk2msftngp13.phx.gbl...
"Eagle" <ea*************@yahoo.com> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
How do I programmatically get the path of my application and IIS? For
instance, my application is in directory Working, but the progrm could be
running from different servers, so when I attempt to write to a file,
using HTTPContext.Current.Request.ApplicationPath, it tries to write to
c:\working, not c:\inetpub\wwwroot\... or whatever is the path on that
server.
Have a look at:
HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"]
and
HttpContext.Current.Request.ServerVariables["PATH_TRANSLATED"]
-or-
VB.Net:
If aren't inside a Control (or derivation of Control) class:
HttpContext.Current.Server.MapPath(HttpContext.Cur rent.Request.ApplicationPath)
If you are inside a Control (or derivation of Control):
Server.MapPath(Request.ApplicationPath)
:) HTH
Mythran