You'll need a custom HttpHandler implementing IHttpHandler. See IHttpHandler.ProcessRequest Method in MSDN. Set the appropriate MIME-type and redirect the binary data from your database to the HttpContext's OutputStream.
An example (guessed, not tested) for a custom handler called Docs.ashx:
using System.IO;
using System.Web;
public class Docs : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
using (var streamReader = new StreamReader("fileSourceForDemonstration.docx"))
{
streamReader.BaseStream.CopyTo(context.Response.OutputStream);
}
}
public bool IsReusable
{
get { return false; }
}
}