Microsoft.Web.Administration.ServerManager.VerifyLocation C# (CSharp) Method

VerifyLocation() private method

private VerifyLocation ( string locationPath ) : void
locationPath string
return void
        internal void VerifyLocation(string locationPath)
        {
            if (locationPath == null)
            {
                return;
            }

            // TODO: add deeper level check
            var parts = locationPath.Split('/');
            if (parts[0] != string.Empty && Sites.All(site => site.Name != parts[0]))
            {
                throw new FileNotFoundException(
                    string.Format(
                        "Filename: \r\nError: Unrecognized configuration path 'MACHINE/WEBROOT/APPHOST/{0}'\r\n\r\n",
                        parts[0]));
            }
        }

Usage Example

Esempio n. 1
0
        public ConfigurationSection GetSection(string sectionPath, string locationPath)
        {
            Initialize();
            if (!_doNotThrow)
            {
                _server.VerifyLocation(locationPath);
            }

            return(FindSection(sectionPath, locationPath, this));
        }