current directory of WebForm ?

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

Chris

Hi,

how can I obtain the name of the directory where my aspx-file is located ?

I tried :
string str = Directory.GetCurrentDirectory();
DirectoryInfo dir = new DirectoryInfo(str);

but Directory.GetCurrentDirectory() returns "C:\WinNt\System32" whereas my
current aspx-file is located in "C:\Inetpub\wwwroot\PersonalWebSite"

Thanks

Chris
 
You can use the static method GetDirectoryName of the Path class in
System.IO.

ie:

System.IO.Path.GetDirectoryName(Request.PhysicalPath));


HTH,
 
Back
Top