locked
httphandlers problem RRS feed

  • Question

  • User368613872 posted

    I want to make all call to SimpleHandler.aspx to go to my class Comments.

    I have made a new class in my App_Code folder with name "Comments.vb" The class name is "Comments" and the code is as follow:

     

    Imports System.Web
    Namespace Acme
    
    Public Class Comments : Implements IHttpHandler
      Public Function GetCommentXML() As XDocument
        return "xml"
      End Function
    
      Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
        Get
    
        End Get
      End Property
    
      Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
    
      End Sub
    End Class
    End Namespace
     

    This line is added in <httpHandlers> section in Web.Config file. 

    <add verb="*" path="SimpleHandler.aspx" type="Acme.Comments,Comments" />

     When I compile the project i get error in web.config on the add verb line:

    <add verb="*" path="SimpleHandler.aspx" type="Acme.Comments,Comments" />

    The project can't recognize the Comment class.

    I use VS 2008. Can someone see what I missed in my code?

    Wednesday, February 13, 2008 5:29 AM

Answers

  • User368613872 posted

    I solved the problem.

    I created a Class Library in my project and added a reference to it from my webproject.

    Then it worked fine. It seems like you must have a dll in the "Bin" folder for the reference.

    <add verb="*" path="SimpleHandler.aspx" type="Comments.MyComments,Comments" />

    Is there any way to say I want to go to a special function when i call SimpleHandler.aspx?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 13, 2008 7:40 AM

All replies

  • User-1281179732 posted

    what .net version you are set on web project .net 2.0 , .net 3.0, .net 3.5

    Wednesday, February 13, 2008 6:26 AM
  • User312496708 posted

    I think in the type you need to specify the type as assembly.namespace.classname, assemblyname.

    Also Have a look at these 2 article.

    http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=307

    http://forums.asp.net/t/1190815.aspx

    Wednesday, February 13, 2008 6:28 AM
  • User368613872 posted

    I use .Net version 3.5

    I'm using the internal iis in Visual Studio.

    Wednesday, February 13, 2008 7:02 AM
  • User368613872 posted

    I solved the problem.

    I created a Class Library in my project and added a reference to it from my webproject.

    Then it worked fine. It seems like you must have a dll in the "Bin" folder for the reference.

    <add verb="*" path="SimpleHandler.aspx" type="Comments.MyComments,Comments" />

    Is there any way to say I want to go to a special function when i call SimpleHandler.aspx?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 13, 2008 7:40 AM