Results 1 to 3 of 3

Thread: Get Current directory

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Get Current directory

    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 ?

    Parksie

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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);

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    I'll give that a go.

    If it works then your a genius.

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width