tencent cloud


Object Access URL

Terakhir diperbarui:2022-05-25 15:36:34


    This document provides a code sample for generating an object access URL.


    • The object access URL generation method described in this document applies only to the scenario where the default domain is used to access public-read objects.
    • For how to access private-read objects, see Getting Pre-Signed URLs.

    SDK API References

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

    Generating Object Access URLs

    If the ACL attribute of an object is set to public-read, you can directly access the object using the URL generated by the following SDK API (only the URL for COS's default origin server domain can be generated):

    // Bucket name in the format of `BucketName-APPID`. You can get APPID by referring to https://console.intl.cloud.tencent.com/developer.
    string bucket = "examplebucket-1250000000";
    string key = "exampleobject"; // Object key
    // Generate a public-read object URL
    string requestURL = cosXml.GetObjectUrl(bucket, key);
    // Request succeeded
    catch (COSXML.CosException.CosClientException clientEx)
    // Request failed
    Console.WriteLine("CosClientException: " + clientEx);
    catch (COSXML.CosException.CosServerException serverEx)
    // Request failed
    Console.WriteLine("CosServerException: " + serverEx.GetInfo());

    For the complete sample, go to GitHub.

    Hubungi Kami

    Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

    Dukungan Teknis

    Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

    Dukungan Telepon 7x24