Trying to create a shared access signature (SAS) Uri for a file which in azure storage accounts. But getting an error when we set expiry to 10000 years Error: The added or subtracted value results in an un-representable DateTime
Is this not possible? Please help.
BlobSasBuilder sasBuilder = new BlobSasBuilder()
{
sasBuilder.ExpiresOn = DateTimeOffset.UtcNow.AddYears(10000);
}
I'm pretty sure 23:59:59.9999999 UTC, December 31, 9999 is the maximum date allowed by a
DateTime. Consider usingDateTime.MaxValueor adding less total years. My preference would be the built inMaxDatethis way you never run into the same issue againTo my knowledge it is not a valid
BlobSasBuilderobject if you leave out the expiration date. So sadly you cannot simply leave the field empty