Using the Path class (VB) : Path « File Directory « ASP.NET Tutorial

Home
ASP.NET Tutorial
1.ASP.Net Instroduction
2.Language Basics
3.ASP.net Controls
4.HTML Controls
5.Page Lifecycle
6.Response
7.Collections
8.Validation
9.Development
10.File Directory
11.Sessions
12.Cookie
13.Cache
14.Custom Controls
15.Profile
16.Configuration
17.LINQ
18.ADO.net Database
19.Data Binding
20.Ajax
21.Authentication Authorization
22.I18N
23.Mobile
24.WebPart
25.XML
ASP.NET Tutorial » File Directory » Path 




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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Page.IsPostBack Then
            Me.lblRootPath.Text = Path.GetPathRoot(Me.txtPathName.Text)
            Me.lblDirectoryName.Text = Path.GetDirectoryName(Me.txtPathName.Text)
            Me.lblFileName.Text = Path.GetFileName(Me.txtPathName.Text)
            Me.lblFileNameWithoutExtension.Text = Path.GetFileNameWithoutExtension(Me.txtPathName.Text)
            Me.lblExtension.Text = Path.GetExtension(Me.txtPathName.Text)

            Me.lblTemporaryPath.Text = Path.GetTempPath()
            Me.lblDirectorySeparatorChar.Text = Path.DirectorySeparatorChar.ToString()
            Me.lblAltDirectorySeparatorChar.Text = Path.AltDirectorySeparatorChar.ToString()
            Me.lblVolumeSeparatorChar.Text = Path.VolumeSeparatorChar.ToString()
            Me.lblPathSeparator.Text = Path.PathSeparator.ToString()

            Me.lblInvalidChars.Text = HttpUtility.HtmlEncode(New String(Path.GetInvalidPathChars()))
            Me.lblInvalidFileNameChars.Text = HttpUtility.HtmlEncode(New String(Path.GetInvalidFileNameChars()))
        End If
    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Working with the Path Class<br />
        <br />
        Enter a path name:
        <asp:TextBox ID="txtPathName" runat="server"></asp:TextBox><br />
        <asp:Button ID="Button1" runat="server" Text="Button" /><br />
        <br />
        Root Path = 
        <asp:Label ID="lblRootPath" runat="server" Text="Label" />
        <br />
        Directory =
        <asp:Label ID="lblDirectoryName" runat="server" Text="Label" />
        <br />
        Filename =
        <asp:Label ID="lblFileName" runat="server" Text="Label" />
        <br />
        Filename (without extension=
        <asp:Label ID="lblFileNameWithoutExtension" runat="server" Text="Label" />
        <br />
        Extension =
        <asp:Label ID="lblExtension" runat="server" Text="Label" />
        <br />
        <br />
        Temporary Directory =
        <asp:Label ID="lblTemporaryPath" runat="server" Text="Label" />
        <br />
        Directory Separator Character =
        <asp:Label ID="lblDirectorySeparatorChar" runat="server" Text="Label" />
        <br />
        Alt Directory Separator Character =
        <asp:Label ID="lblAltDirectorySeparatorChar" runat="server" Text="Label" />
        <br />
        Volume Separator Character =
        <asp:Label ID="lblVolumeSeparatorChar" runat="server" Text="Label" />
        <br />
        Path Separator Character =
        <asp:Label ID="lblPathSeparator" runat="server" Text="Label" />
        <br />
        Invalid Path Characters =
        <asp:Label ID="lblInvalidChars" runat="server" Text="Label" />
        <br />
        Invalid FileName Characters =
        <asp:Label ID="lblInvalidFileNameChars" runat="server" Text="Label" />
    
    </div>
    </form>
</body>
</html>














10.5.Path
10.5.1.Using the Path class (C#)
10.5.2.Using the Path class (VB)
10.5.3.File Path Parsing (C#)
10.5.4.File Path Parsing (VB)
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.