Question

I have a site that has a strange behavior :

When hitting a page which need an authentication, we treat it like this :

  • a http module detects the need for authentication =>

returns status 401 :

context.Response.StatusCode = 401;
// Prevents any other content from being sent to the browser
context.Response.SuppressContent = true;
// Directs the thread to finish, bypassing additional processing
context.ApplicationInstance.CompleteRequest();
  • the redirection to the auth form is detected and a redirection is done to the appropriate login form :

Redirect code :

context.Response.Redirect(url, false);
// Directs the thread to finish, bypassing additional processing
context.ApplicationInstance.CompleteRequest();

When a site with this code runs on IIS7 no problem is observed. But with IIS 6 the login form takes 2 minutes and counting to load (with IE, Firefox, sometimes it works fine with Chrome but not always).

When using fiddler I can see the header (302 : redirect to the final login form) is received pretty fast but the browser waits for "ServerDoneResponse" to redirect and it takes at least 2 minutes.

At first, there was no CompleteRequest() and I thought adding it will solve the problem but it hasn't.

Does anybody have any idea about the problem ?

Thanks in advance

Edit : the problem occurs on a site hosted on Windows 2003 R2 SP2

Edit #2 : Information given by Fiddler :

ClientConnected:    14:27:39.219
ClientBeginRequest: 14:27:39.297
GotRequestHeaders:  14:27:39.297
ClientDoneRequest:  14:27:39.297
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect:     0ms
HTTPS Handshake:    0ms
ServerConnected:    14:27:39.250
FiddlerBeginRequest:14:27:39.297
ServerGotRequest:   14:27:39.297
ServerBeginResponse:14:27:39.328
GotResponseHeaders: 14:27:39.328
ServerDoneResponse: 14:29:48.867
ClientBeginResponse:14:29:48.867
ClientDoneResponse: 14:29:48.867

Overall Elapsed:    00:02:09.5694285
Was it helpful?

Solution

By removing SuppressContent = true, there's no more problem with II6.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top