Application directory

  • Thread starter Thread starter Christina Androne
  • Start date Start date
C

Christina Androne

Hello C#ers

I need to know how to find out the application's path from a web
application. By application path I understand:
if my ISAPI is placed on http://localhost/mydir, I want
c:\Inetpub\wwwroot\mydir or even http://localhost/mydir, eather one is
good.
Can this be done ? Help please!

Thanks for all the answers that will hopefully follow :)))
Christina Androne
 
Christina Androne said:
Hello C#ers

I need to know how to find out the application's path from a web
application. By application path I understand:
if my ISAPI is placed on http://localhost/mydir, I want
c:\Inetpub\wwwroot\mydir or even http://localhost/mydir, eather one is
good.
Can this be done ? Help please!

I've had success using this:

string AppPath=Request.ServerVariables["PATH_TRANSLATED"]; // path to aspx
file
int k=AppPath.LastIndexOf("\\");
AppPath=AppPath.Substring(0,k+1); // strip off file name
 
Bill said:
I've had success using this:

string AppPath=Request.ServerVariables["PATH_TRANSLATED"]; // path
to aspx file
int k=AppPath.LastIndexOf("\\");
AppPath=AppPath.Substring(0,k+1); // strip off file name

Yes, but I am not in an ASP.NET application :(. I am in a plain ISAPI
dll (please do not ask why :) ). I want to know the path to it. In a
normaly ISPAI I would use GetModuleFileName but in the NET framework
it's not working, it is not returning the correct path.

Christina Androne.
 
Back
Top