17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5: <strong>FILESTREAM</strong> with ASP.NET and SilverlightResponse.BufferOutput = false;Response.ContentType = "image/jpeg";BinaryWriter bw = new BinaryWriter(Response.OutputStream);Listing 5-12:Accessing the OutputStream property <strong>of</strong> the Response object.Refer to Chapter 12, in the section entitled Best Practices for <strong>FILESTREAM</strong> Development,to learn about the potentially useful addition <strong>of</strong> a timestamp column to allow for caching<strong>FILESTREAM</strong> data that is sent over the web.Running and testing the applicationWe have finished the code, so we can now verify that the application is working asexpected. In Visual Studio, set the web page that we created in this lab as the default page,and run the application.When the web page is open in the browser, add a parameter to the query string. Enter theitem number <strong>of</strong> a record that exists in the table. This will retrieve the image associatedwith the specified item, and the image will be displayed on your browser (Figure 5-21).Figure 5-21:Running the application.In the next lab we will see how to use this page as the URL source for item thumbnailimages we display on a web page.193

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!