Sir,
below is .ashx file shows error on
If context.Session("photo1") <> "" Then
why? I need to display an image on button click that saved in database.
imgHandler.ashx:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
If context.Session("photo1") <> "" Then
Dim bytes() As Byte = DirectCast(context.Session("photo1"), [Byte]())
context.Response.Buffer = True
context.Response.Charset = ""
context.Response.Cache.SetCacheability(HttpCacheability.NoCache)
context.Response.ContentType = "image/jpeg"
'context.Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows(0)("Name").ToString())
context.Response.BinaryWrite(bytes)
context.Response.Flush()
context.Response.End()
End If
End Sub
on display page on button click:
Session("photo1") = HttpUtility.HtmlEncode(ds.Tables(0).Rows(0)("applicant_photo").ToString())
Image1.ImageUrl = "../imgHandler.ashx"