文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C# webForm 文件访问 路径

C# webForm 文件访问 路径

时间:2011-04-14  来源:鱼不爱水

string[] getDirectoryFiles(string dirVPath, string pattern)
        {
            string dirVPathRooted = string.Concat(
                HttpContext.Current.Request.ApplicationPath.ToLower(),
                dirVPath);
            string dirPath = HttpContext.Current.Server.MapPath(dirVPathRooted);

            string[] files = Directory.GetFiles(dirPath, pattern, SearchOption.AllDirectories);
            string[] includes = new string[files.Length];
            for (int i = 0; i < files.Length; i++)
            {
                includes[i] = files[i]
                    .Replace(dirPath, dirVPath) // replace physical root by virtual root
                    .Replace('\\', '/');
            }
            return includes;
        }

相关阅读 更多 +
排行榜 更多 +
步行僵尸2无限金币版

步行僵尸2无限金币版

体育竞技 下载
狐狸一号特殊任务无限金币版

狐狸一号特殊任务无限金币版

体育竞技 下载
忍者之雷复仇无限金币钻石版

忍者之雷复仇无限金币钻石版

体育竞技 下载