path.aspx

来自「asp.net技术内幕的书配源码」· ASPX 代码 · 共 25 行

ASPX
25
字号
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>

<script language="C#" runat=server>

void Page_Load(Object sender , EventArgs e) 
{
// get a Temporary File
string strPath = Path.GetTempFileName();
Response.Write( "<li>Created TempFile " + strPath );

// Retrieve File Name
Response.Write( "<li>The name of the file is " );
Response.Write( Path.GetFileName( strPath ) );

// Retrieve Directory Name
Response.Write( "<li>The name of the directory is " );
Response.Write( Path.GetDirectoryName( strPath ) );

// Retrieve File Extension
Response.Write( "<li>The file has the extension " );
Response.Write( Path.GetExtension( strPath ) );
}
</script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?