Home All Groups Group Topic Archive Search About
Author
8 Sep 2006 7:30 AM
Peter Kirk
Hi

we have some classes which sometimes run in a web application, and sometimes
run in standalone applications. These classes have some configuration
parameters, of which one is a file-path to some resources (eg. to some text
files).

In order to ease configuration when deployed in a web-app (especially if
redeployed or if the server is altered) we use
HttpContext.Current.Server.MapPath(...)

but this means that the classes no longer run in a non web-application. What
is a good way around this? Should be check if there is a HttpContext, and if
so then "map" the path?


Thanks,
Peter

Author
8 Sep 2006 9:08 AM
Ciaran O'Donnell
You can get the path the exe/dlls are in with
System.AppDomain.CurrentDomain.SetupInformation.PrivateBinPath

HTH


Ciaran O'Donnell


Show quoteHide quote
"Peter Kirk" wrote:

> Hi
>
> we have some classes which sometimes run in a web application, and sometimes
> run in standalone applications. These classes have some configuration
> parameters, of which one is a file-path to some resources (eg. to some text
> files).
>
> In order to ease configuration when deployed in a web-app (especially if
> redeployed or if the server is altered) we use
> HttpContext.Current.Server.MapPath(...)
>
> but this means that the classes no longer run in a non web-application. What
> is a good way around this? Should be check if there is a HttpContext, and if
> so then "map" the path?
>
>
> Thanks,
> Peter
>
>
>



Post Thread options