code_junkie

How to Make ASP.NET MVC Recognize IHttpAsyncHandler from IRouteHandler.GetHttpHandler()?

Nov 12th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public class AsyncMvcRouteHandler : IRouteHandler
  2. {
  3. public IHttpHandler GetHttpHandler(RequestContext requestContext)
  4. {
  5. return new AsyncMvcHandler(requestContext);
  6. }
  7.  
  8. class AsyncMvcHandler : IHttpAsyncHandler, IRequiresSessionState
  9. {
  10. public AsyncMvcHandler(RequestContext context)
  11. {
  12. }
  13.  
  14. // IHttpHandler members
  15. public bool IsReusable { get { return false; } }
  16. public void ProcessRequest(HttpContext httpContext) { throw new NotImplementedException(); }
  17.  
  18. // IHttpAsyncHandler members
  19. public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
  20. {
  21. throw new NotImplementedException();
  22. }
  23.  
  24. public void EndProcessRequest(IAsyncResult result)
  25. {
  26. throw new NotImplementedException();
  27. }
  28. }
  29. }
  30.  
  31. routes.Add(new Route("{controller}/{action}/{id}", new AsyncMvcRouteHandler())
  32. {
  33. Defaults = new RouteValueDictionary(new { controller = "Home", action = "Index", id = "" }),
  34. });
  35. }
  36.  
  37. routes.MapRoute(
  38. "Default",
  39. "{controller}/{action}",
  40. new { controller = "Home", action = "Index" }
  41. );
Add Comment
Please, Sign In to add comment