Application location

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I am writing an .net assembly that can be called from a windows
application or from a web application and need to know the location of
the application that it is running under to be able to load an
initialisation file that may be above the application folder.

It should be the folder the application was run from or in an ASP.net
application it should be the same as
Request.ServerVariables.RootFilePath but I need to get at it in
Global.asax when Request is unavailable.

Where can I get this info?
 
Hi,

In which event you cant access
HttpContext.Current.Request.ApplicationPath. as far as i know you can
get it from application_start, Session_Start and
Application_BeginRequest.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Server.MapPath does work inside the ASP application, thanks.
I've also discovered Path.GetFullPath which I call if Server isn't present.

Thanks
 
Back
Top