Link to home
Start Free TrialLog in
Avatar of longjumps
longjumps

asked on

MS IIS 7.5 - HTTP Message Error code customization

In my filter inside of IIS7.5 for some conditions I am deciding to send blocking message.
Generally I am using HTTP code 200.
But sometime there is a need to send another one.
When another one is chosen and it is not in the range 400-500 everything is ok and message is going out of IIS with this HTTP code and relevant content I put.

But if I choose for example HTTP code 403 - IIS intercepting it, putting HTTP code 200 and embed the code I custom to 403 inside of HTML body.

Can somebody advice on this?
Avatar of longjumps
longjumps

ASKER

Attached is the example of what happen with response message that was send to browser from IIS 7 when I am trying to send block message from one of filters with HTTP code 403.
However other code, e.g. 205 no problem!
 User generated image
I did more test on this issue so once I browse some site from local browser or curl tool I am getting correct message for block with content I am expecting.
However once I browse for same site that from my IIS module I am sending blocking message with Error Code IIS takes "ownership" and send his 403 message instead of mine that was customise in my IIS module.

This happens only in IIS7, with error codes  4xx and 5xx, other codes I succeeded override and IIS7 is not overriding them again.

Can somebody help on this?

ASKER CERTIFIED SOLUTION
Avatar of longjumps
longjumps

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found solution by myself and spent time on that.

Now I am sharing this advanced topic with others.