System.Configuration.ConfigurationErrorsException.AlwaysSafeFilename C# (CSharp) Метод

AlwaysSafeFilename() статический приватный Метод

static private AlwaysSafeFilename ( string filename ) : string
filename string
Результат string
        internal static string AlwaysSafeFilename(string filename) {
            if (string.IsNullOrEmpty(filename)) {
                return filename;
            }

            // configuration file can be an http URL in IE
            if (StringUtil.StartsWithIgnoreCase(filename, HTTP_PREFIX)) {
                return filename;
            }

            //
            // If it is a relative path, return it as is. 
            // This could happen if the exception was constructed from the serialization constructor,
            // and the caller did not have PathDiscoveryPermission for the file.
            //
            try {
                if (!Path.IsPathRooted(filename)) {
                    return filename;
                }
            }
            catch {
                return null;
            }

            // Get just the name of the file without the directory part.
            try {
                string fullPath = FullPathWithAssert(filename);
                filename = Path.GetFileName(fullPath);
            }
            catch {
                filename = null;
            }

            return filename;
        }