我是 HTTP 处理程序的新手,我正在努力找出我当前代码的问题所在
我似乎收到了这个错误
类 'Handler' 必须为接口 'System.Web.IHttpHandler' 实现 'Sub ProcessRequest(context As HttpContext)'。
使用此代码时
<%@ WebHandler Language="VB" Class="Handler" %>
Imports System
Imports System.Web
Imports System.Configuration
Imports System.Data.SqlClient
Public Class Handler
Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext)
Dim connStr As String = ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString
Dim con As New SqlConnection(connStr)
' Create SQL Command
Dim cmd As New SqlCommand()
cmd.CommandText = "Select * from My_Images" +
" where id =@id"
cmd.CommandType = System.Data.CommandType.Text
cmd.Connection = con
Dim ImageID As New SqlParameter("@investor", System.Data.SqlDbType.Int)
ImageID.Value = context.Request.QueryString("id")
cmd.Parameters.Add(ImageID)
con.Open()
Dim dReader As SqlDataReader = cmd.ExecuteReader()
dReader.Read()
context.Response.BinaryWrite(DirectCast(dReader("Image"), Byte()))
dReader.Close()
con.Close()
End Sub
Public ReadOnly Property IsReusable As Boolean _
Implements IHttpHandler.IsReusable
Get
Return True
End Get
End Property
End Class
有没有人有任何想法?
提前致谢