Help & Documentation>Cloud Object Storage>SDK Documentation>.NET(C#) SDK>Setting Access Domain Names (CDN/Global Acceleration)

Setting Access Domain Names (CDN/Global Acceleration)

Last updated: 2023-09-13 12:28:38

Feature Overview

This document describes how to request the COS service by using a non-default domain name.

SDK API References

For parameters and method description of all APIs in the SDK, see SDK API Reference.

Custom origin domain name

For more information, see Enabling Custom Origin Domain.
The sample code below shows how to access a COS service using a custom origin server domain name.

Sample code

CosXmlConfig config = new CosXmlConfig.Builder()
.SetRegion("COS_REGION") // Set a default bucket region
// The request domain is your.domain.com
.SetHost("your.domain.com") // Custom domain name
.Build();
Note
For the complete sample, go to GitHub.

Global acceleration domain name

For more information on global acceleration, see Overview.
The sample code below shows how to access a COS service using a global acceleration endpoint.

Sample code

CosXmlConfig config = new CosXmlConfig.Builder()
.SetEndpointSuffix("cos.accelerate.myqcloud.com")
.Build();
Note
For the complete sample, go to GitHub.

Custom CDN domain name

The sample code below shows how to access a COS service using a custom CDN acceleration domain name.

Sample code

CosXmlConfig config = new CosXmlConfig.Builder()
.SetHost("exampledomain.com")
.Build();
Note
For the complete sample, go to GitHub.

Default CDN domain name

The sample code below shows how to access a COS service using a default CDN acceleration domain name.

Sample code

CosXmlConfig config = new CosXmlConfig.Builder()
.SetEndpointSuffix("file.myqcloud.com")
.Build();
Note
For the complete sample, go to GitHub.