Playing with the HttpHandler to talk to a server application

P

pamelafluente

I have implemented an example of HttpHandler to talk with my Windows
application running on the server.

I want to send some command (to do something) from IE (client) to my
program running on the server. The HttpHandler is able to intercept
this request and to process it.

Here is the code:

'COMPLETE CODE
--------------------------------------------------------------

Imports System.Web

Public Class MyHttpHandler
Implements IHttpHandler

' Override the ProcessRequest method.
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest

context.Response.Write("URL: " & context.Request.Url.Host &
"<br>")
context.Response.Write("<H1>My first Handler</H1>")
context.Response.Write("Browsing with <br>")
context.Response.Write("Type: " & context.Request.Browser.Type
& "<br>")
context.Response.Write("Version: " &
context.Request.Browser.Version)

'Here I want to send the command to my windows application
'running on this server

End Sub

' Override the IsReusable property.
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return True
End Get
End Property

End Class

'---------------------------------------------------------------------------------------

This must be placed on C:\Inetpub\wwwroot\bin\HandlerTest.exe

and a C:\Inetpub\wwwroot\web.config file serves to route the request

here is the file:

----------------------------------- C:\Inetpub\wwwroot\web.config
file
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="handler.aspx"
type="HandlerTest.MyHttpHandler,HandlerTest"/>
</httpHandlers>
</system.web>
</configuration>
---------------------------------------

(It's important in the IIS configuration to select ASP 2).

This works fine. My question now is:

What is the best way to encode /decode my command from the ASP page to
the
subroutine Sub ProcessRequest(ByVal context As HttpContext).

And once I have decoded it how do I (awake my server application and)
talk to it?

Any suggestion?

-Pam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top