private HttpError GetHttpError(ConfigurationElement element, WebVirtualDirectory virtualDir) { if (element == null || virtualDir == null) return null; // skip inherited http errors if (!element.IsLocallyStored) return null; // var error = new HttpError { ErrorCode = Convert.ToString(element.GetAttributeValue(StatusCodeAttribute)), ErrorSubcode = Convert.ToString(element.GetAttributeValue(SubStatusCodeAttribute)), ErrorContent = Convert.ToString(element.GetAttributeValue(PathAttribute)), HandlerType = Enum.GetName(typeof(HttpErrorResponseMode), element.GetAttributeValue(ResponseModeAttribute)) }; // Make error path relative to the virtual directory's root folder if (error.HandlerType.Equals("File") // 0 is supposed to be File && error.ErrorContent.Length > virtualDir.ContentPath.Length) { error.ErrorContent = error.ErrorContent.Substring(virtualDir.ContentPath.Length); } // return error; }
private HeliconZooEngine ConvertElementToHeliconZooEngine(ConfigurationElement item) { HeliconZooEngine result = new HeliconZooEngine(); result.name = (string)item.GetAttributeValue("name"); result.displayName = (string)item.GetAttributeValue("displayName"); result.arguments = (string)item.GetAttributeValue("arguments"); result.fullPath = (string)item.GetAttributeValue("fullPath"); result.arguments = (string)item.GetAttributeValue("arguments"); result.transport = (string)item.GetAttributeValue("transport"); result.protocol = (string)item.GetAttributeValue("protocol"); result.host = (string)item.GetAttributeValue("host"); result.portLower = (long) item.GetAttributeValue("portLower"); result.portUpper = (long) item.GetAttributeValue("portUpper"); result.maxInstances = (long) item.GetAttributeValue("maxInstances"); result.minInstances = (long) item.GetAttributeValue("minInstances"); result.timeLimit = (long) item.GetAttributeValue("timeLimit"); result.gracefulShutdownTimeout = (long) item.GetAttributeValue("gracefulShutdownTimeout"); result.memoryLimit = (long) item.GetAttributeValue("memoryLimit"); List<HeliconZooEnv> envList = new List<HeliconZooEnv>(); ConfigurationElementCollection envColl = item.GetChildElement("environmentVariables").GetCollection(); foreach (ConfigurationElement el in envColl) { envList.Add(ConvertElementToHeliconZooEnv(el)); } result.environmentVariables = envList.ToArray(); // TODO: fix this result.isUserEngine = false; // TODO: disabled return result; }
private HeliconZooEnv ConvertElementToHeliconZooEnv(ConfigurationElement item) { HeliconZooEnv result = new HeliconZooEnv(); result.Name = (string)item.GetAttributeValue("name"); result.Value = (string)item.GetAttributeValue("value"); return result; }
private bool GetSwitchBoardValue(ConfigurationElement switchboardElement) { return (0 == String.Compare((string)switchboardElement.GetAttributeValue("value"), "Enabled", StringComparison.OrdinalIgnoreCase)); }
private HttpHeader GetCustomHttpHeader(ConfigurationElement element) { if (element == null) return null; // return new HttpHeader { Key = Convert.ToString(element.GetAttributeValue(NameAttribute)), Value = Convert.ToString(element.GetAttributeValue(ValueAttribute)) }; }
// translate IIS setting on extended protection to NCL object static internal void ReadIisExtendedProtectionPolicy(ConfigurationElement element, out ExtendedProtectionTokenChecking tokenChecking, out ExtendedProtectionFlags flags, out List<string> spnList) { tokenChecking = (ExtendedProtectionTokenChecking)element.GetAttributeValue(MetabaseSettingsIis7Constants.TokenCheckingAttributeName); flags = (ExtendedProtectionFlags)element.GetAttributeValue(MetabaseSettingsIis7Constants.FlagsAttributeName); spnList = new List<string>(); foreach (ConfigurationElement configElement in element.GetCollection()) { spnList.Add((string)configElement[MetabaseSettingsIis7Constants.NameAttributeName]); } }
private MimeMap GetMimeMap(ConfigurationElement element) { // skip inherited mime mappings if (element == null || !element.IsLocallyStored) return null; // return new MimeMap { Extension = Convert.ToString(element.GetAttributeValue(FileExtensionAttribute)), MimeType = Convert.ToString(element.GetAttributeValue(MimeTypeAttribute)) }; }
private string GetDefaultDocument(ConfigurationElement element) { if (element == null) return null; // return Convert.ToString(element.GetAttributeValue(ValueAttribute)); }