Partial AJAX rendering problems for the default page in IIS 7 when using a custom HTTP module

Problem

When I try to request a partial AJAX update (using the UpdatePanel control) from the default page on the IIS7 website, it does not work - instead of returning html for the update, it returns the whole page, which then calls MS AJAX Javascript to quit parsing.

Supposed reason

I narrowed down the cause to two problems - an AJAX request to the default page when I have a specific http user module registered. The partial http: // localhost rendering request will fail, but the partial http: //localhost/default.aspx rendering request will work fine. Also, if I delete the following line in my custom HttpModule:

_application.PreRequestHandlerExecute += OnPreRequestHandlerExecute;

AJAX partial rendering will work correctly. Wierd huh

Another weird thing ... If I look at trace.axd, I see that when a partial rendering request fails, two POST requests are logged for one partial rendering request - the one where the default.aspx page successfully executes (trace information , such as page_load, is registered), but the content is not created, and the second, which is not actually executed (trace information is not registered), but creates the content (HTTP_CONTENT_LENGTH is greater than 0).

Please, help! If anyone who knows the HTTP modules or the MS AJAX Http module well can explain why this is happening, I would really appreciate it. Be that as it may, the obvious work of arround is simply to redirect to default.aspx if the request URL is "/", but I would really like to understand why this is happening.

+3
1

PreRequestHandlerExecute HTTP.

HttpModules IIS7 - , HttpModules web.config system.webServer.

, , PreRequestHandlerExecute :

void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
    HttpApplication application = (HttpApplication)sender;
    HttpContext context = application.Context;

    if(  something-happened  )
         context.Handler = null;
}

, .

, , , ASP.Net .

, HttpHandler.

+1

Source: https://habr.com/ru/post/1745141/


All Articles