/// <summary>
        /// 设置错误页
        /// </summary>
        public static void SetRelocation(string url)
        {
            XmlNode         node = GetOrAddTreeNode("configuration-system.webServer-httpRedirect");
            MapStringString map  = new MapStringString("enabled", "true");

            map.Add("destination", url);
            node.AddAttributes(map);
            Save();
        }
        /// <summary>
        /// 设置错误页
        /// </summary>
        public static void SetErrorPage(string errorPage)
        {
            XmlNode node = GetOrAddTreeNode("configuration-system.web-customErrors");

            node.AddAttributes(new MapStringString("mode", "RemoteOnly"));

            node = GetOrAddTreeNode("configuration-system.web-customErrors-error");
            MapStringString map = new MapStringString("statusCode", "404");

            map.Add("redirect", errorPage);
            node.AddAttributes(map);

            Save();
        }
        /// <summary>
        /// 修改配置文件的APP设置
        /// </summary>
        public static void SetAppSetting(string key, string value)
        {
            RemoveAppSetting(key);

            MapStringString attributes = new MapStringString("key", key);

            attributes.Add("value", value);
            var node          = CreateNode("add", attributes);
            var containerNode = GetOrAddTreeNode("configuration-appSettings");

            containerNode.AddChildNode(node);

            Save();
        }
 public IMatchResult Match(NameValueCollection headers)
 {
     using (var mappedHeaders = new MapStringString())
     {
         foreach (var header in HttpHeaders)
         {
             var value = headers[header];
             if (String.IsNullOrEmpty(value) == false)
             {
                 mappedHeaders.Add(header, value);
             }
         }
         return((IMatchResult)_provider.getMatch(mappedHeaders));
     }
 }
        /// <summary>
        /// 添加允许下载的文件
        /// </summary>
        public static void AddMimes(params string[] fileNames)
        {
            foreach (string fileName in fileNames)
            {
                //容器节点
                XmlNode containerNode = GetOrAddTreeNode("configuration-system.webServer-staticContent");

                string          fileExtension = FileUtil.GetExtension(fileName);
                MapStringString attributes    = new MapStringString("fileExtension", fileExtension);
                XmlNode         removeNode    = CreateNode("remove", attributes);
                containerNode.AddChildNode(removeNode);

                attributes.Add("mimeType", "application/octet-stream");//通用下载格式
                XmlNode mimeMapNode = CreateNode("mimeMap", attributes);
                containerNode.AddChildNode(mimeMapNode);
            }
            Save();
        }
    public override void on_GetResourcesResponse(GetResourcesResponse msg, long correlationId)
    {
        ResourceVector resources = msg.resources;

        Console.WriteLine(resources.Count + " resources received.");
        foreach (Resource resource in msg.resources)
        {
            Console.WriteLine("*************************************************");
            Console.WriteLine("uri : " + resource.uri);
            Console.WriteLine("data type : " + resource.dataObjectType);
            Console.WriteLine("name : " + resource.name);
            Console.WriteLine("*************************************************");
        }

        Console.WriteLine("Asking to get the first dataobject");
        GetDataObjects  gdo    = new GetDataObjects();
        MapStringString uriMap = new MapStringString();

        uriMap.Add("0", resources[0].uri);
        gdo.uris = uriMap;
        getSession().send(gdo, 0, 0x02);
    }