I need the Generic Handler but when I try to add it it isn't in the list. I see ASP.net Handler but not the Generic Handler.
I am needing to connect to a Podio webhook and I am following the instructions at http://podio.github.io/podio-dotnet/webhooks/
Here is the code example:
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using PodioAPI;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
// API key setup
string clientId = "YOUR_CLIENT_ID";
string clientSecret = "YOUR_CLIENT_SECRET";
// Authentication setup
int appId = 123456;
string appToken = "YOUR_APP_TOKEN";
// Setup client and authenticate
var podio = new Podio(clientId, clientSecret);
podio.AuthenticateWithApp(appId, appToken);
// Big switch statement to handle the different events
var request = context.Request;
switch (request["type"])
{
case "hook.verify":
podio.HookService.ValidateHookVerification(int.Parse(request["hook_id"]), request["code"]);
break;
// An item was created
case "item.create":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int itemIdOfCreatedItem = int.Parse(request["item_id"]);
// Fetch the item and do what ever you want
break;
// An item was updated
case "item.update":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int itemIdOfUpdatedItem = int.Parse(request["item_id"]);
// Fetch the item and do what ever you want
break;
// An item was deleted
case "item.delete":
// For item events you will get "item_id", "item_revision_id" and "external_id". in post params
int deletedItemId = int.Parse(request["item_id"]);
break;
}
}
public bool IsReusable {
get {
return false;
}
}
}