Error using HttpModules in ASP.NET

0

It turns out that I'm using httpModules to handle the AuthenticateRequest and AuthorizeRequest events in the application. In the web.config I have it linked in the following tags:

<system.webServer>
    <modules>
         <add type="Proyecto.App.UI.CustomAuthenticationModule" name="CustomAuthenticationModule"/>
    </modules>
</system.webServer>

The project has no compilation errors, so it runs correctly. However, I'm getting the error in the front-end, and the browser console (Google Chrome) throws the following:

This causes events with ajax to not work (autocomplete in textbox).

What am I doing wrong? When you remove the httpModules, the application works correctly.

Greetings and I hope you can help me.

    
asked by Francisco 02.11.2016 в 17:46
source

1 answer

0

with what type of channel do you have your App Pool configured?

If you use Classic Channeling then you must define your HttpModule in the web.config in the following way

<configuration>
    <system.web>
        <httpModules>
            <add type="Proyecto.App.UI.CustomAuthenticationModule" name="CustomAuthenticationModule"/>
        </httpModules>
    </system.web>
</configuration>

If you use Integrated Channeling then you must define your HttpModule in the web.config as follows

<configuration>
    <system.webServer>
        <modules>
            <add type="Proyecto.App.UI.CustomAuthenticationModule" name="CustomAuthenticationModule"/>
        </modules>
    </system.webServer>
</configuration>

I would also check if you have established in your web.config both the HttpHandler and the HttpModule for the AJAX configuration (check the version numbers you work with)

<configuration>
    <system.web>
        <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
        </httpHandlers>
        <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </httpModules>
    </system.web>
</configuration>
    
answered by 03.11.2016 в 00:00