2011-07-27 10 views
1

それはHTTPハンドラに来るとき、私は初心者だと私は私の現在のコードHTTPハンドラの問題

とproblemisが、私はこのエラーに

クラスを取得しているように見えるものをうまくするために苦労しています'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 [email protected]" 
     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 

は、誰もが任意のアイデアを持っていますか?

ありがとうございます。

答えて

0

試してみてください。

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

あなたはまた、IsReusable財産上の実装が必要になります。

2

メソッド宣言Public Sub ProcessRequest(ByVal context As HttpContext)はあなたに感謝:)その小さな栗ああPublic Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest