Improve support for Handlers

3 views
Skip to first unread message

Marco v. Frieling

unread,
Dec 30, 2006, 12:43:56 PM12/30/06
to PageMethods
Hello.

At the root level I have a handler BuildPdfDoc.ashx which looks like
this:

<%@ WebHandler Language="VB" Class="BuildPdfDoc" %>

Imports System
Imports System.Web
Imports MetaSapiens.PageMethods

Public Class BuildPdfDoc : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
' ...
PageMethodsEngine.InvokeMethod(Me)
End Sub

<MetaSapiens.PageMethods.PageMethod(True)> _
Public Sub Execute(ByVal id As Guid)
' ...
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return False
End Get
End Property

End Class

After rebuilding the website I found the following in the PageList.xml:

<Page url="/BuildPdfDoc.ashx">
<Files>
<File name="BuildPdfDoc.ashx" changeDate="2006-12-30 16:57:16Z"
/>
</Files>
</Page>

So it seems that the AddIn has found the Execute method in the Handler
class which is marked with the PageMethod attribute. But it has not
extracted the informations for the method and it's parameters itself,
so I added them manually to the PageList.xml. Then the AddIn generated
code resulting in the following call (base namespace: "URLs"):

URLs.BuildPdfDoc.ashx.BuildPdfDoc.Execute(Guid.NewGuid())
^^^^^^^^^^^^^^^^^

This code is not nice, the marked part should be eliminated.

When I rebuild the website after the BuildPdfDoc.ashx has changed, the
methods tag for the handler is removed from PageList.xml, so I have to
re-add it.

The only possible way to get PageMethods work for Handlers is using a
second PageList.xml file and updating it by hand. It would be very
helpful if handlers are supported in the same way as pages because they
often are used to generate contents dynamically on demand, like images,
PDF file etc.

Thanks,

Marco

Fabrice Marguerie

unread,
Feb 13, 2007, 10:55:34 AM2/13/07
to PageMethods
Hello Marco,

I have added support for HTTP handlers to the todo-list.
I'll investigate and you may see support for this appear in a future
release.

Fabrice

Reply all
Reply to author
Forward
0 new messages