current directory of WebForm ?

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
 
S

Scott Allen

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

ie:

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


HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top