c# code 128 font Deleting BLOBs in C#

Drawer ANSI/AIM Code 128 in C# Deleting BLOBs

Deleting BLOBs
Code 128 Generation In C#.NET
Using Barcode creator for .NET framework Control to generate, create Code 128A image in VS .NET applications.
www.OnBarcode.com
Code 128 Code Set A Decoder In Visual C#.NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
Deleting a BLOB is similar to uploading a file except that you re deleting the BLOB instead of uploading it (cute, huh ). Just like the upload file example in listing 9.5, you get the reference to the BLOB, and then delete the BLOB by calling the following:
PDF 417 Printer In C#
Using Barcode encoder for .NET Control to generate, create PDF417 image in Visual Studio .NET applications.
www.OnBarcode.com
UPC Code Generation In Visual C#
Using Barcode printer for VS .NET Control to generate, create GTIN - 12 image in Visual Studio .NET applications.
www.OnBarcode.com
blob.Delete();
EAN / UCC - 13 Drawer In Visual C#
Using Barcode generation for .NET framework Control to generate, create GTIN - 128 image in .NET framework applications.
www.OnBarcode.com
Code 39 Extended Generation In C#
Using Barcode creator for Visual Studio .NET Control to generate, create Code 39 Extended image in .NET applications.
www.OnBarcode.com
The following listing shows the code that will delete the BLOB in your web page.
Generating Data Matrix ECC200 In C#.NET
Using Barcode maker for .NET framework Control to generate, create Data Matrix 2d barcode image in .NET applications.
www.OnBarcode.com
International Standard Serial Number Generator In Visual C#.NET
Using Barcode encoder for .NET Control to generate, create ISSN image in .NET framework applications.
www.OnBarcode.com
Listing 9.6 Deleting the BLOB
Creating Code 128 In Visual Basic .NET
Using Barcode creation for VS .NET Control to generate, create Code 128B image in Visual Studio .NET applications.
www.OnBarcode.com
Scanning Code 128 Code Set C In .NET Framework
Using Barcode scanner for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
protected void gvBlobs_RowCommand (object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { DeleteBlob(e.CommandArgument.ToString()); } BindGrid(); } private void DeleteBlob(string blobName) { CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); CloudBlobClient blobClient = account.CreateCloudBlobClient();
Creating Code39 In Java
Using Barcode drawer for Java Control to generate, create Code-39 image in Java applications.
www.OnBarcode.com
Generating 2D Barcode In VS .NET
Using Barcode drawer for ASP.NET Control to generate, create 2D Barcode image in ASP.NET applications.
www.OnBarcode.com
Downloading BLOBs
Drawing Barcode In Java
Using Barcode generator for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Decoding Barcode In C#
Using Barcode Control SDK for VS .NET Control to generate, create, read, scan barcode image in Visual Studio .NET applications.
www.OnBarcode.com
CloudBlobContainer container = blobClient.GetContainerReference(Request["container"] as string); var blob = container.GetBlobReference(blobName); blob.Delete(); } protected void gvBlobs_RowDeleting(object sender, GridViewDeleteEventArgs e) { }
PDF-417 2d Barcode Generation In Java
Using Barcode maker for Java Control to generate, create PDF-417 2d barcode image in Java applications.
www.OnBarcode.com
UPC - 13 Printer In .NET
Using Barcode encoder for Reporting Service Control to generate, create EAN-13 Supplement 5 image in Reporting Service applications.
www.OnBarcode.com
Deletes the BLOB
Barcode Creation In Java
Using Barcode drawer for BIRT Control to generate, create Barcode image in BIRT reports applications.
www.OnBarcode.com
Barcode Decoder In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
As you can see, deleting a BLOB is pretty simple. Now you can list, upload, and delete BLOBs from your storage account using your ASP.NET management website hosted in your Windows Azure web role. Let s complete the management page example by looking at how you can download BLOBs.
2D Printer In VB.NET
Using Barcode creator for .NET framework Control to generate, create 2D image in Visual Studio .NET applications.
www.OnBarcode.com
Data Matrix Drawer In Objective-C
Using Barcode drawer for iPhone Control to generate, create Data Matrix image in iPhone applications.
www.OnBarcode.com
Downloading BLOBs
In this section we ll look at how to download BLOBs from both a public container and a private container. To take things nice and easy, we ll tell you how to download BLOBs that are stored in a public container first.
Downloading BLOBs from a public container
If your BLOB is hosted in a public container, you can present the URI of the BLOB directly to the user and they ll be able to directly download the file to their browser. In our podcasting sample, the following URI will download podcast01.wma from the ChrisConverted public container in the development storage account: http://127.0.0.1:10000/ devstoreaccount1/ChrisConverted/podcast01.wma. Because the BLOB is held in a public container, the user won t need to provide any credentials to access the BLOB. If you ve correctly set the MIME type of your podcast, when the URI is pasted into your browser, the podcast will automatically start playing in Windows Media Player.
In our management web page example, we don t want to expose the podcasts to the world; we want to restrict access to our own credentials. Let s look at how you can do that using your new best friend, the storage client.
Downloading BLOBs from a private container using the storage client
Now we want you to modify your management web page so that if you click the View button for the selected podcast, as shown in figure 9.5, you re prompted to download the file (also shown in figure 9.5). Although you can store the BLOB in a public container to achieve the same result, in this example you re going to first download the BLOB to your web role and then serve the BLOB from your web role, rather than directly from BLOB storage.
Uploading and downloading BLOBs
Clicking the View button on your BLOBs page opens a Save dialog box
In listing 9.3, we defined the ASPX for your View button; listing 9.7 is where we hook up the code that will download the file when this button is clicked. The code in the following listing will download the selected BLOB and prompt the user with the Save dialog box shown in figure 9.5.
Listing 9.7 Downloading BLOBs from the grid using the storage client
protected void gvBlobs_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { DeleteBlob(e.CommandArgument.ToString()); } if (e.CommandName == "View") { DownloadBlob(e.CommandArgument.ToString()); } BindGrid(); } private void DownloadBlob(string blobName) { CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); CloudBlobClient blobClient = account.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference(Request["container"] as string); var blob = container.GetBlobReference(blobName);
using (var ms = new MemoryStream()); Creates memory stream { and downloads BLOB blob.DownloadToStream(ms); Response.ContentType = blob.Properties.ContentType; Response.AddHeader("Content-Disposition", "attachment; filename=" blobName);
w Sets
MIME type
Integrating BLOBs with your ASP.NET websites
Response.BinaryWrite(ms.ToArray()); } }
Writes file to response stream
At q you create a new memory stream that writes the contents of the BLOB that s been downloaded from BLOB storage. At w you set the MIME type of the file so that you can allow the browser to perform the correct action based on that type (for example, launch Windows Media Player, Microsoft Word, or some other action), and you add the content-disposition header so that the browser knows to offer a Save file dialog box to the user. Finally, the downloaded BLOB is made available to the client by writing the file to the response stream e. In the previous example, we used the DownloadToStream option to download files from BLOB storage but the storage client also offers these methods to download files: DownloadText, DownloadByteArray, and DownloadToFile.
So far we ve shown you how to download files that are in public or private containers. What if you want to do something a little more granular, like control access to your BLOBs or containers For operations like this, you can use a Shared Access Signature. Later on, we ll look at this feature in a little more detail. Now that you know how to upload and download BLOBs, let s look at how you can integrate BLOB storage with your existing ASP.NET websites.
Copyright © OnBarcode.com . All rights reserved.