小编Hay*_*ore的帖子

Azure blob 存储下载到流返回“”asp.net

我目前正在尝试使用 DownloadToStream 方法从 Azure blob 存储下载文件,以将 blob 的内容下载为文本字符串。但是我没有得到任何东西,而是一个空字符串。

这是我用来连接到 azure blob 容器并检索 blob 文件的代码。

    public static string DownLoadFroalaImageAsString(string blobStorageName, string companyID)
    {
        // Retrieve storage account from connection string.
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnectionString"));

        // Create the blob client.
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

        // Retrieve reference to a previously created container.
        CloudBlobContainer container = blobClient.GetContainerReference(companyID.ToLower());

        //retrieving the actual filename of the blob
        string removeString = "BLOB/";
        string trimmedString = blobStorageName.Remove(blobStorageName.IndexOf(removeString), removeString.Length);

        // Retrieve reference to a blob named "trimmedString"
        CloudBlockBlob …
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-storage-blobs

7
推荐指数
2
解决办法
2万
查看次数

更改甜蜜警报2的叠加背景颜色

我最近将 Sweet Alert 1 移至 Sweet Alert 2,但根据文档,没有选项可以对像 Sweet Alert 1 这样的警报框的覆盖背景进行主题化

.swal-overlay {
  background-color: rgba(43, 165, 137, 0.45);
}.
Run Code Online (Sandbox Code Playgroud)

请问如何实现更改Sweet Alert 2的叠加背景?

javascript sweetalert2

4
推荐指数
1
解决办法
3万
查看次数

甜蜜警报关闭时如何收听

我目前正在与sweetalert2合作,并且尝试检测警报何时关闭。但是,不会触发DeleteUnsavedImages函数。我认为将功能分配给onclose键会起作用,但是没有运气。

   swal({
       html: data,
       showCloseButton: false,
       showCancelButton: false,
       width: 800,
       showConfirmButton: false,
       onClose: DeleteUnsavedImages()
   }).then(function () {

   });


function DeleteUnsavedImages(){
    var test = "-1";
}
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激 :-)

javascript jquery sweetalert sweetalert2

3
推荐指数
1
解决办法
6065
查看次数

将文件上传到azure blob存储,然后使用文件base64字符串发送http响应不起作用

我试图使用azures blob存储实现以下功能.

  1. 将文件上传到azure blob存储.
  2. 然后发送包含该文件的base64字符串的http响应.

奇怪的是,我只能使用一个工作,因为它会导致另一个工作,这取决于我的代码的顺序.

        HttpPostedFile image = Request.Files["froalaImage"];
        if (image != null)
        {
            string fileName = RandomString() + System.IO.Path.GetExtension(image.FileName);
            string companyID = Request.Form["companyID"].ToLower();

            // Retrieve storage account from connection string.
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create the blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve reference to a previously created container.
            CloudBlobContainer container = blobClient.GetContainerReference(companyID);

            // Create the container if it doesn't already exist.
            container.CreateIfNotExists();

            // Retrieve reference to a blob named "filename".
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName); …
Run Code Online (Sandbox Code Playgroud)

.net c# azure azure-storage-blobs

1
推荐指数
1
解决办法
596
查看次数

重新打开时,从azure下载PDF无法加载

我试图从内存流中的azure的blob存储中下载pdf文件.但是,当我尝试打开文件时,它不会加载.

这是我正在使用的代码. 下载代码

    protected void blobDownload_Click(object sender, EventArgs e)
    {
        //Getting the blob storage container values
        DBAccess dbaCon = new DBAccess();
        DataTable dt = dbaCon.GetTrainingRecord(TrainingTrainingRecordID.Value);
        string companyID = dt.Rows[0].Field<string>("fk_company_id");
        string blobStorageName = dt.Rows[0].Field<string>("uploaded_file");
        string filename = dt.Rows[0].Field<string>("display_file_name");

        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobClient.GetContainerReference(System.Text.RegularExpressions.Regex.Replace(companyID.ToLower(), @"\s+", ""));
        CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobStorageName);
        MemoryStream memStream = new MemoryStream();
        blockBlob.DownloadToStream(memStream);
        blockBlob.FetchAttributes();
        HttpResponse response = HttpContext.Current.Response;
        //response.ContentType = blockBlob.Properties.ContentType;
        response.ContentType = "application/pdf";
        response.AddHeader("Content-Disposition", "Attachment; filename=" + filename);
        response.AddHeader("Content-Length", blockBlob.Properties.Length.ToString());
        response.BinaryWrite(memStream.ToArray()); …
Run Code Online (Sandbox Code Playgroud)

c# pdf firefox azure azure-blob-storage

1
推荐指数
1
解决办法
413
查看次数

ajax完成后如何使Sweet alert自动关闭?

我正在使用甜蜜警报,但如果 ajax 的请求完成,我想让它自动关闭

swal({
  title: "Are you sure?",
  text: "You are choosing order by custom search",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Confirm",
  closeOnConfirm: false,
  timer: **AUTO WITH AJAX??**
},
Run Code Online (Sandbox Code Playgroud)

我正在添加一个变量

var dones = $(document).ajaxComplete(function(){
                            swal.close()
                        });
Run Code Online (Sandbox Code Playgroud)

并像这样制作 swal

swal({
  title: "Are you sure?",
  text: "You are choosing order by custom search",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Confirm",
  **timer: dones,**
  closeOnConfirm: false
},
Run Code Online (Sandbox Code Playgroud)

但仍然不像我预期的那样

php ajax sweetalert sweetalert2

1
推荐指数
1
解决办法
6202
查看次数