Forum Moderators: open
I'm just starting researching this. Has anyone done anything like this before, either writing or retrieving blobs in Oracle?
Thanks!
Ross
Public Class Attachment
Implements IHttpHandlerPublic ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
Get
Return False
End Get
End PropertyPublic Sub ProcessRequest(ByVal context As System.Web.HttpContext) _
Implements System.Web.IHttpHandler.ProcessRequest
'some code goes here to retrieve strId from the
'file name or query string or some such
'and fill the dataset with the record.
Dim abyte() As Byte _
= dsBugDetails.TblAttachments.FindByintAttachmentId(CInt(strId)).binAttachment
context.Response.OutputStream.Write(abyte, 0, abyte.Length)
context.Response.End()
End Sub
Then you need to add to the web.config file to the directory where this is located (where the DefaultNamespace is the namespace that the Attachment class comes from and AssemblyName is the assembly it is found in):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpHandlers>
<add verb="GET,HEAD" path="*.pdf" type="DefaultNamespace.Attachment,AssemblyName" />
</httpHandlers>
</system.web>
</configuration>
You will also need to modify the IIS mappings to have *.pdf to go through .NET.