I need to get the name of my current directory.
If I use mappath I get the full path e.g
C:/inetpub/wwwroot/mysite/mydir
All I want is "mydir"
Any ideas how to do this ?
Printable View
I need to get the name of my current directory.
If I use mappath I get the full path e.g
C:/inetpub/wwwroot/mysite/mydir
All I want is "mydir"
Any ideas how to do this ?
You can use the DirectoryInfo object in the System.IO namespace:
Code:string s = Server.MapPath(Request.ApplicationPath);
DirectoryInfo d = new DirectoryInfo(s);
Response.Write(d.Name);
I'll give that a go.
If it works then your a genius.