English 中文(简体)
HTTP 处理问题
原标题:HTTP handlers problems

我对吉大港山区管理者来说,是一个新奇,在努力解决与我现行法典有关的问题时,我 and。

我似乎正在发现这一错误。

班级残疾者必须实施接口系统的分程序要求(文本作为HttpContext)。 Web.IHttpHandler 。

使用该守则

    <%@ 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

是否有任何人的想法?

Thanks in advance

最佳回答

your method declaration is wrong. This should do it:

Public Sub ProcessRequest(context As HttpContext) 

MSDN link: http://msdn.microsoft.com/de-de/library/system.web.ihttphandler.isreusable.aspx

支票:

问题回答

方法声明

Public Sub ProcessRequest(ByVal context As HttpContext)

应当

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

Try:

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

你们还需要落实可使用的财产。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签