Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用URL和Directory.GetFiles获取图片数_C#_Asp.net - Fatal编程技术网

C# 使用URL和Directory.GetFiles获取图片数

C# 使用URL和Directory.GetFiles获取图片数,c#,asp.net,C#,Asp.net,我想获取网站文件夹中的图片数量。但我找不到办法 我试着用 string a = Request.QueryString["nr"]; string[] filePaths = Directory.GetFiles(@"URL" + a, a + "_profil*"); 但它不起作用。我得到一个错误: 异常详细信息:System.ArgumentException:URI格式不受支持。它需要文件系统上文件夹的路径,例如c:\some\folder\。根据您正在执行的操作,您可能能够使用Serv

我想获取网站文件夹中的图片数量。但我找不到办法

我试着用

string a = Request.QueryString["nr"];
string[] filePaths = Directory.GetFiles(@"URL" + a, a + "_profil*");
但它不起作用。我得到一个错误:


异常详细信息:System.ArgumentException:URI格式不受支持。

它需要文件系统上文件夹的路径,例如
c:\some\folder\
。根据您正在执行的操作,您可能能够使用
Server.MapPath(“~/some/folder”)
解析完整路径。

在远程或当前网站上?如果当前使用Server.MapPath()