Esempio n. 1
0
        /// 获取存储桶跨域规则
        public void GetBucketCors()
        {
            //.cssg-snippet-body-start:[get-bucket-cors]
            try
            {
                string bucket = "examplebucket-1250000000"; //格式:BucketName-APPID
                GetBucketCORSRequest request = new GetBucketCORSRequest(bucket);
                //执行请求
                GetBucketCORSResult result = cosXml.GetBucketCORS(request);
                //存储桶的 CORS 配置信息
                CORSConfiguration conf = result.corsConfiguration;
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                //请求失败
                Console.WriteLine("CosClientException: " + clientEx);
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                //请求失败
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
            }

            //.cssg-snippet-body-end
        }