Try our conversational search powered by Generative AI!

Trigger HttpHandler on specific URL


How do I trigger a HttpHandler on a specific url? For example */external/*

The purpose is for retrieving an external document and stream out to the page.

Mar 20, 2018 14:27

you would need to add some magic in web.config file:

      <add name="ExternalResourceHandler" 
           type="{FQN of your HTTP handler type + assembly name}"/>
Mar 23, 2018 8:23

I did try that but it didn't work.

Instead I had to add this:

routes.Add(new Route("external/{guid}", new ExternalRouteHandler()));

public class ExternalRouteHandler: IRouteHandler


         publicIHttpHandler GetHttpHandler(RequestContext requestContext)


                    return new ExternalHttpHandler();



public class ExternalHttpHandler : IHttpHandler


            public bool IsReusable


                       get { return false; }


           public void ProcessRequest(HttpContext context)


                  //Your ccustom code here



Mar 23, 2018 8:33

hm, interesting. my web.config works just fine. are "run managed stuff for all requests" enabled in web.config?

btw, assume that you need to *insert* this route at the beginning and not adding that (as it might be overwritten by some epi "final not found route")?

Mar 23, 2018 10:21

Yes, runAllManagedModulesForAllRequests is enabled.

I don't follow your meaning with insert and adding. :)

Mar 23, 2018 10:51

guess for the routing you should be fine with just adding a route. sometimes we noticed that route is added "too late" to the route table resulting in some overwrites and route handler does not have chance to execute anymore.

Mar 23, 2018 12:23
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.