簡體   English   中英

訪問Windows Azure的BLOB上存儲的文本文件

[英]Accessing the text file that is stored on BLOB of Windows Azure

我正在使用Windows Azure。 我遵循了一些有關如何將文本文件存儲到Windows Azure的Blob的教程。 我成功上傳了數據。 現在,我想訪問該文件。 我的意思是,我必須閱讀文件的內容並顯示它。

誰能告訴我,該怎么做...

提前致謝...

使用DownloadText(): http//msdn.microsoft.com/en-us/library/ee772911.aspx


        public CloudBlobContainer ContBlob; 

    public string UpFile(string FilePathName, string bName, NameValueCollection nM)
    {
        string s1;
        FileStream F1 = new FileStream(FilePathName, FileMode.Open, FileAccess.Read);            
        ContBlob.GetBlobReference(bName).UploadFromStream(F1);
        s1 = ContBlob.GetBlobReference(bName).ToString();     
        ContBlob.GetBlobReference(bName).Metadata.Add(nM);
        F1.Close();
        return s1;
    }


    public NameValueCollection DownFile(string FilePathName, string bName)
    {
        NameValueCollection nM = new NameValueCollection();
        FileStream F1 = new FileStream(FilePathName,  FileMode.Create, FileAccess.Write);
        ContBlob.GetBlobReference(bName).DownloadToStream(F1);
        nM = ContBlob.GetBlobReference(bName).Metadata;
        F1.Close();
        return nM;
    }

    public NameValueCollection DownMeta(string bName)
    {
        NameValueCollection nM = new NameValueCollection();
        nM = ContBlob.GetBlobReference(bName).Metadata;
        return nM;
    }

    public void UpMeta(string bName, NameValueCollection nM)
    {
        ContBlob.GetBlobReference(bName).Metadata.Clear();
        ContBlob.GetBlobReference(bName).Metadata.Add(nM);
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM