1

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;
        }
    }

}
Xiolin
  • 121
  • 10
  • Do you mean you don't see `IHttpHandler`? Did you add `System.Web` as a reference? – Ron Beyer May 17 '19 at 14:36
  • Yes, I added 'using System.web' at the top. No, I mean I don't see Generic Handler as an option when I try to add an item to the project. – Xiolin May 17 '19 at 14:55
  • Just add a basic class and type it yourself. I assume you are talking about the template types when you add a new item by clicking in the project and selecting "Add New..."? – Ron Beyer May 17 '19 at 14:57
  • I typed it myself and I get red lines on: <%@ WebHandler Language = "C#" Class="Handler1" %> and IHttpHandler and HttpContext – Xiolin May 17 '19 at 15:06
  • I also just explicitly added `System.web` as a reference and the same red lines are there. – Xiolin May 17 '19 at 15:30

0 Answers0