API | 操作名 | 操作描述 |
设置静态网站 | 设置存储桶的静态网站配置 | |
查询静态网站配置 | 查询存储桶的静态网站配置 | |
删除静态网站配置 | 删除存储桶的静态网站配置 |
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";PutBucketWebsiteRequest putRequest = new PutBucketWebsiteRequest(bucket);putRequest.SetIndexDocument("index.html");putRequest.SetErrorDocument("eroror.html");putRequest.SetRedirectAllRequestTo("index.html");PutBucketWebsiteResult putResult = cosXml.PutBucketWebsite(putRequest);//请求成功Console.WriteLine(putResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";GetBucketWebsiteRequest request = new GetBucketWebsiteRequest(bucket);//执行请求GetBucketWebsiteResult result = cosXml.GetBucketWebsite(request);//请求成功Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";DeleteBucketWebsiteRequest request = new DeleteBucketWebsiteRequest(bucket);//执行请求DeleteBucketWebsiteResult result = cosXml.DeleteBucketWebsite(request);//请求成功Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
本页内容是否解决了您的问题?