private static String fixName(String pathname) { Char[] forbiddenSymbols = new Char[] { '<', '>', ':', '\'', '/', '\\', '|', '?', '*' }; String result = ""; foreach (Char el in pathname) { if (!forbiddenSymbols.Contains(el)) if (el == '&') result += "%26"; else result += el; } return result; }