Home > Net >  How to close SAS URI of fileshare after the work is done?
How to close SAS URI of fileshare after the work is done?

Time:04-28

I am using this code:

var fileSas = file.GenerateSasUri(Azure.Storage.Sas.ShareFileSasPermissions.Read, DateTime.UtcNow.AddMinutes(2));

in the above mentioned code I am making this fileSas accessible to at least 2 minutes even when my work is done before. Is there a way to close this connection after i have used it successfully to copy the files to blob?

CodePudding user response:

Like @Skin mentioned you cannot automatically make the Uri expire but one way to get this work is to have the expiration time for a long period (i.e., in days or hours), get the work done, and then delete the blob as soon as the work is done. While considering the other question the SAS gets expired/deleted as soon as the blob is deleted.

  • Related