我需要通用处理程序,但是当我尝试添加它时,它不在列表中。我看到了ASP.net处理程序,但没有看到通用处理程序。
我需要连接到Podio Webhook,并且按照http://podio.github.io/podio-dotnet/webhooks/上的说明进行操作
这是代码示例:
<%@ 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;
}
}
}