Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save micahasmith/2635847 to your computer and use it in GitHub Desktop.

Select an option

Save micahasmith/2635847 to your computer and use it in GitHub Desktop.
ihttpasynchandler example
public class TestMethods
{
public static void Handle(HttpContext c)
{
c.Response.ContentType = "text/plain";
c.Response.Write(string.Format("Hello World async {0}", Fib(10)));
}
static int Fib(int x)
{
if (x <= 1)
return 1;
return Fib(x - 1) + Fib(x - 2);
}
}
public class async_httphandler_test :IHttpAsyncHandler
{
public bool IsReusable
{
get
{
return true;
}
}
private static Action<HttpContext> _Handle = TestMethods.Handle;
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
{
return _Handle.BeginInvoke(context, cb, null);
}
public void EndProcessRequest(IAsyncResult result)
{
}
public void ProcessRequest(HttpContext context)
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment