CallbackHandler is an Http Handler base class that allows you to create a class with methods marked up with a [CallbackMethod] attribute which are then exposed for remote execution. The handler routes the to the methods and executes the call and returns the results - or any errors - as JSON strings.
To use this service you need to create an HttpHandler (either .ASHX or a class registered in web.config's httpHandler section) and then add methods with the [CallbackMethod] attribute and that's it. The service accepts inputs via query string and POST data.
If you use the AjaxMethodCallbackControl the process of calling service methods is fully automated including automatic client proxy creation and you can call methods with individual parameters mapped from client to server.
Alternately you can also use plain REST calls that pass either no parameters and purely access POST data, or pass a single JSON object that can act as a single input parameter.
The service can be accessed with:
MyHandler.ashx?CallbackMethod=MethodToCall
POST data can then be passed in to act as parameters:
<
- > <
- > <>Raw Post Buffer<> You simply pass raw POST data that you can access with Request.Form in the handler
<
- > <>JSON value or object string<> Alternately you can set the content type to application/json and pass a JSON string of a value or object which calls the server method with a single parameter of matching type. <
For more information on how to call these handlers see Using CallbackHandler with REST Calls.
Westwind.Web.CallbackHandler
public class CallbackHandler : object, IHttpHandler
Class Members
Member | Description | |
---|---|---|
Constructor |
||
ProcessRequest |
Handle the actual callback by deferring to JsonCallbackMethodProcessor() public virtual void ProcessRequest(HttpContext context) |
|
Context |
Shortcut to the current HttpContext instance | |
IsReusable |
This handler is not thread-safe | |
Request |
Shortcut reference to active ASP.NET Request object | |
Response |
Shortcut to the ASP.NET Response object. | |
RouteData |
Optionally store RouteData on this handler so we can access it internally |
Requirements
Namespace: Westwind.WebAssembly: westwind.web.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic