我正在使用Windows Azure。我按照一些关于如何将文本文件存储到windows azure的blob上的教程。 我成功上传了数据。现在,我想访问该文件。我的意思是,我必须阅读文件的内容并显示它....
谁能告诉我,怎么做......
谢谢, 事先......
答案 0 :(得分:1)
使用DownloadText():http://msdn.microsoft.com/en-us/library/ee772911.aspx
答案 1 :(得分:0)
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);
}