Created
May 8, 2012 14:50
-
-
Save micahasmith/2635847 to your computer and use it in GitHub Desktop.
ihttpasynchandler example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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