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