public string Token() { var storageSasProvider = new StorageSasProvider("fxprgconfit", "0JlbNBt6/5d2yEWU2o35oPXpFncaYNHY8mz5eF4HiSKe1IbKgKKC57Bh8+NznwYJYbm3be+w1t44E8wraS4FNQ=="); var result = storageSasProvider.CreateSasForContainer("auroratest", 0.5).Result; return(result); }
public IActionResult Token(BlobContainerSasRequestModel model) { try { if (ModelState.IsValid) { var storageSasProvider = new StorageSasProvider(model.StorageAccountName, model.StorageAccountKey); var token = storageSasProvider.CreateSasForContainer(model.BlobContainerName, model.ActivationPeriod).Result; return(RedirectToAction("TokenSuccess", new { Token = token, ExpireAt = DateTime.Now.AddHours(model.ActivationPeriod).ToString() })); } return(RedirectToAction("TokenFailure", new { Error = "Some error in generating the token" })); } catch (Exception error) { return(RedirectToAction("TokenFailure", new { Error = error.Message })); } }