惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
D
DataBreaches.Net
腾讯CDC
I
InfoQ
F
Fortinet All Blogs
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
月光博客
月光博客
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
C
Check Point Blog

博客园 - Yu

依赖注入的 Singleton、Scoped、Transient vs2015 编译报错:The project references NuGet package(s) that are missing on this computer... discuz 迁移 uc_server 报错 The timeout period elapsed prior to completion of the operation or the server is not responding. 微信小程序笔记 xmlns 与 targetNamespace 的解释 Ubuntu64 apache2+lvs+Keepalived NPOI CellStyle 设置 mysql --initialize specified but the data directory has files in it select2 多选设置默认值 VS 2015 IDE 不支持 MS SQL 2000 生成 dbml Ajax 如何执行 Response.Redirect ng 发生 Error: ELOOP: too many symbolic links encountered... jquery call cross-domain webapi owin self-host HtmlAgilityPack 使用 微信 oauth2 两次回调 EF 热加载 Winform/Asp.net vs2015 使用 Eazfuscator.NET 3.3 The requested page cannot be accessed because the related configuration data for the page is invalid.
Illegal characters in path
Yu · 2021-11-27 · via 博客园 - Yu

执行ClearInvalidChars后,清除完成!

 public static string ClearInvalidChars(string fullname) {

            var source = fullname;
            char[] cp = new char[] { '\u002A', '\u003A', '\u003F','\u0022','\u003C', '\u003E', '\u007C' };
            var root = fullname.Substring(0, fullname.IndexOf(":")+1);
            var relative = fullname.Substring(fullname.IndexOf(":")+1, fullname.Length- fullname.IndexOf(":")-1);
            foreach (var c in cp)
            {
                relative = relative.Replace(c.ToString(), "_");
            }
            fullname = root + relative;
            var chars = Path.GetInvalidPathChars();
            foreach (var c in chars)
            {
                fullname = fullname.Replace(c.ToString(), "_");
            }
            chars = Path.GetInvalidFileNameChars();
            var path = Path.GetDirectoryName(fullname);
            var filename = Path.GetFileName(fullname);
            foreach (var c in chars)
            {
                filename = filename.Replace(c.ToString(), "_");
            }
            return Path.Combine(path, filename);
        }