I have defined a custom HTTP handler, to update the request header. But when I am calling http://localhost:52705/Home/Index. my custom HTTP handler is not getting called for that controller -> action request. I implemented as follow
public class TestHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
return;
}
public bool IsReusable { get; private set; }
}
also, find the web.cofing entry for HTTPHandler
<system.webServer>
<handlers>
<add name="TestHandler" type=" mvc_app.Handler.TestHandler" path="*" verb="*"/>
</handlers>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
After spending one day if found one trick to achieve the same functionality as I want to implement using IHttpModule
Add custom HTTP module
Update web.config to register custom HTTP module
for the above solution still, I am trying to figure it out why my OnBeginRequest() method is getting called twice