Thursday, 7 March 2013

IIS vs Cassini different behaviors on ASP.NET Server.Transfer

Here is the problem.

Opening the page http://localhost:3187/passwordForgot (which is served by Cassini) works OK:

image

But opening the same page on http://localhost/passwordForgot (hosted by IIS) gives us this result (i.e. the browser is not recognizing the content as HTML):

image

This problem happens on Chrome and Firefox, and ironically it works in IE (usually it is the other way around (i.e. it breaks in IE)

image 

Let’s look at the raw requests to see if we can spot the difference.

After firing up Fiddler and repeating the requests:

image

We can see that the IIS request doesn't have the Content-Type set (note that the back-end code is the same, so what changed is the way the server handles the ASP.NET Server Transfers)

Here are the Response Headers for both servers:

IIS: image Cassini: image

Here is the server-side TM code that triggers the Server.Transfer:

image

Here is a fix:

image

That worked :)

Page view in IIS: image 

Headers in IIS:   image
Post a Comment