File Directory ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>


    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            this.lblRootPath.Text = Path.GetPathRoot(this.txtPathName.Text);
            this.lblDirectoryName.Text = Path.GetDirectoryName(this.txtPathName.Text);
            this.lblFileName.Text =  Path.GetFileName(this.txtPathName.Text);
            this.lblFileNameWithoutExtension.Text = Path.GetFileNameWithoutExtension(this.txtPathName.Text);
            this.lblExtension.Text = Path.GetExtension(this.txtPathName.Text);
            this.lblTemporaryPath.Text = Path.GetTempPath();
            this.lblDirectorySeparatorChar.Text = Path.DirectorySeparatorChar.ToString();
            this.lblAltDirectorySeparatorChar.Text = Path.AltDirectorySeparatorChar.ToString();
            this.lblVolumeSeparatorChar.Text = Path.VolumeSeparatorChar.ToString();
            this.lblPathSeparator.Text = Path.PathSeparator.ToString();
            this.lblInvalidChars.Text = HttpUtility.HtmlEncode( new String(Path.GetInvalidPathChars() ) );
            this.lblInvalidFileNameChars.Text = HttpUtility.HtmlEncode( new String(Path.GetInvalidFileNameChars()));
        }
    }



    Untitled Page


    
    

        Working with the Path Class
        
        Enter a path name:
        
        
        
        Root Path = 
        
        
        Directory =
        
        
        Filename =
        
        
        Filename (without extension) =
        
        
        Extension =
        
        
        Temporary Directory =
        
        
        Directory Separator Character =
        
        
        Alt Directory Separator Character =
        
        
        Volume Separator Character =
        
        
        Path Separator Character =
        
        
        Invalid Path Characters =
        
        
        Invalid FileName Characters =