IIS 7.5 difference between Windows 7 and Server 2008 r2

I think that is not a bad idea to develop directly with a Windows server 2008 R2 as development pc OS, because sometimes you can encounter subtle differences as the one explained in this post.

I’m developing with a HP Notebook (HP quality is a bit degraded from the glorious ’80: my screen after 2 years has some very little scratches caused from the keyboard keys that touches the screen when the notebook is closed …) , with Windows 7 ultimate 64 bit as OS.

IIS is the latest release:

I’m working to an ASP.NET 4 project , where i’m heavily using JQuery, so i have a lot of page methods (no postback! is evil !) called by passing JSON strings , the page method does something and returns to a javascript callback.

Tipically in a db (in this case SQL Server 2012) there a a lot of constraints and checks, that causes an error for example in a update record method.

The catch code in my page methods is always something as (but there are many other magic numbers…):

There is a routine (ManagePKFKConstraintsMsgs) that verify if the error string contains the name of a check (for example) , if so the function returns a custom string for the user , that tipically is showed in a window.alert; otherwise the better thing to do is a error log and then redirect the user to a custom “Yellow Death Page”.
In my example objDB.MsgToUser can returns something as “The age must be between 0 and 99”, the javascript callback is, for example

So in the callback i test the status : if 409 then the responseText is my custom message , to be showed to user with a window.alert which is included in the xData.responseText , among other markup.

On my development pc all ok (this is the first time i have tried this new approach), instead when i have published the site on the production Windows Server 2008 r2 , surprise : in xData.responseText there was the string “The page was not displayed because there was a conflict”, so this was the result:

I have verifyed the Windows Server 2008 r2 IIS version:

Ops… same version of my Win 7… so ?

The answer is that IIS in Windows 2008 R2 overrides by default the HTTP response with its default error management (pages and other) , this default behavior can be fortunately overriden by using the TrySkipIisCustomErrors property of the Response object.

Unfortunately, there are problems also between different versions of Windows server: for example some years ago i had serious problems with date fields with Latvian as browser language ( a website used also from an hospital in Riga) with the pages hosted in a Windows 2003 server; the hosting migrated to Windows 2008 and et voilà , problem disappeared.