目标:我有一个缩略图作为内存中的字节数组。一旦用户上传了他们的图像,我想在将其写入数据库之前将其显示在 httphandler 中。我已使用此代码成功读取它并从数据库中显示。但现在我想从会话中显示它:
Public Sub ProcessRequest(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest
Dim oPhotoMgt As New PhotoMgt
Dim intPhotoID As Int32 = context.Request.QueryString("id")
Dim oPhoto As New Photo
oPhoto = oPhotoMgt.GetPhotoByID(intPhotoID)
context.Response.ContentType = "image/jpeg"
context.Response.BinaryWrite(oPhoto.Bytes.ToArray())
End Sub