Get Application Path

  • Thread starter Thread starter Heidi Hundåla
  • Start date Start date
H

Heidi Hundåla

Hi !

I am trying to find the application path dynamically,
meaning the place on disc where my web app is residing, like some function
that
returns "C:\Inetpub\wwwroot\MyApp\".

Is there a funcion like that ?

Regards,
Heidi V. Hundåla
(e-mail address removed)
 
I am trying to find the application path dynamically, meaning the place on
disc where my web app is residing, like some function that
returns "C:\Inetpub\wwwroot\MyApp\".

Is there a funcion like that ?

Maybe try:

System.Environment.CurrentDirectory
System.Environment.GetEnvironmentVariable(s)

or some other System.Environment options might work, depending on what you
are trying to do.
 
System.Environment.CurrentDirectory
gave me C:\Windows\System32\

and how can
System.Environment.GetEnvironmentVariable(s)
work, what should the "s" be ?

I want to find the path to where my app is on the C disc, meaning
if my app is in C:\Inepub\wwwroot\MyApplication\
then the function should return that exact path,
"C:\Inepub\wwwroot\MyApplication\".

The natural thing would be Application.Path, but it doesn't exist.

Regards,
Heidi
(e-mail address removed)
 
"HttpRequest" is in the System.Web namespace. However, the shortened
"Request" is a property of the inherited System.Web.UI.Page object, so
"Request" is the same as "this.Request".

Jon
 
... and by the way, if you need to know the HttpRequest object of the current
context but you're not in the context of a System.Web.UI.Page object, you
can try to obtain the HttpRequest object of the current context by using:

System.Web.HttpContext.Current.Request

HTH,
Jon
 
Back
Top