API | Operation | Description |
Sending a preflight request for cross-origin access | Sends a preflight request to check whether a real cross-origin access request can be sent |
try{string bucket = "examplebucket-1250000000"; // Bucket in the format: BucketName-APPIDstring key = "exampleobject"; // Object keystring origin = "http://cloud.tencent.com";string accessMthod = "PUT";OptionObjectRequest request = new OptionObjectRequest(bucket, key, origin, accessMthod);// Set the validity period of the signaturerequest.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600);// Execute the requestOptionObjectResult result = cosXml.OptionObject(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?