I have a web app that I need to change to work with Windows Azure Web Sites. Two text file are uploaded and parsed then a third file is written line by line with the parsed data. I've found that I can't upload files directly to an Azure Web Site and need to use Blob Storage. This is pretty straight forward. What I am unable to find is how to write a text file line by line to a Blob or maybe there would be a better solution? I need to re-create this code to work with an Azure Web Site:
using (var writer = new StreamWriter(filePath, false))
{
foreach (Product product in pm.GetAll())
{
fp = pm.MakeFinal(product);
curLine.Append(fp.InventoryNumber + "\t");
curLine.Append(fp.SellerCost + "\t");
curLine.Append(fp.RetailPrice + "\t");
curLine.Append(fp.StartingBid + "\t");
curLine.Append(fp.BINPrice + "\t");
curLine.Append(fp.CAPrice + "\t");
curLine.Append(fp.Weight + "\t");
curLine.Append(fp.Length + "\t");
curLine.Append(fp.Width + "\t");
curLine.Append(fp.Height + "\t");
curLine.Append(fp.Brand + "\t");
curLine.Append(fp.Manufacturer + "\t");
curLine.Append(fp.MPN + "\t");
curLine.Append(fp.Quantity);
writer.WriteLine(curLine.ToString());
}
}
Is it possible to use a streamwriter to write a text file line by line to an Azure Blob. If not, what would be a good alternative way to do this?
Edit ------------------------------
This doesn't answer the question I asked but I no longer need to use Azure blob storage. I added the following to my web.config and both files upload fine, the third file is being created fine also:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000" />
</requestFiltering>
</security>