API | Operation | Description |
Setting a static website configuration | Configures a static website for a bucket | |
Querying a static website configuration | Queries the static website configuration of a bucket | |
Deleting a static website configuration | Deletes the static website configuration of a bucket |
try{// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string 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);// Request succeededConsole.WriteLine(putResult.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";GetBucketWebsiteRequest request = new GetBucketWebsiteRequest(bucket);// Execute the requestGetBucketWebsiteResult result = cosXml.GetBucketWebsite(request);// Request succeededConsole.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// Bucket name in the format of bucketname-APPID. You can get APPID by referring to https://console.tencentcloud.com/developer.string bucket = "examplebucket-1250000000";DeleteBucketWebsiteRequest request = new DeleteBucketWebsiteRequest(bucket);// Execute the requestDeleteBucketWebsiteResult result = cosXml.DeleteBucketWebsite(request);// Request succeededConsole.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){// Request failedConsole.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){// Request failedConsole.WriteLine("CosServerException: " + serverEx.GetInfo());}
Was this page helpful?