-
ASP.NET MVC 4 RC & ASP.NET Web API: Return “HTTP Status code 4xx” instead of throwing InvalidOperationException “No MediaTypeFormatter is available to read an object of type ‘[…]’ from content with media type ‘[…]’”
By default ASP.NET Web API (included in ASP.NET MVC 4) throws the following exception when trying to process a request with an unsupported content-type (like “text/plain”): System.InvalidOperationException No MediaTypeFormatter is available to read an object of type ‘[…]’ from content with media type ‘[…]’. IMHO, sending a wrong content-type is a client-side error, and the […]
-
ISA Server 2006 & HTTP Compression: No support for “Quality value” in “Accept-Encoding” header
When using the ISA Server 2006 in a web publishing scenario, the ISA Serbver 2006 can take care of compressing the content to reduce the number of bytes that needed to be send to the clients. Compression is especially advisable when serving JavaScript and CSS files because text-based files can be compressed with a very […]
-
IIS 7.5 on Windows 7: How to fix “HTTP Error 401.3 – Unauthorized”
If you try to run a web application on IIS 7.5 and Windows 7 and you get the following error HTTP Error 401.3 – Unauthorized You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server. it […]
-
ASP.NET: Disable browser and proxy caching for aspx resources
The following lines of code can be put into a .aspx file to prevent the resource from being cached on clients or proxies: To prevent caching, these lines of code change the header of the server’s HTTP response by setting the following values: Cache-Control: no-cache, no-store Expires: -1 Pragma: no-cache You can read more about […]
-
PHP 5: Send HTTP post request with file_get_contents
The following code snippet shows an easy way how to send a HTTP post request using the PHP function file_get_contents: $url = ‘http://server.com/path’; $data = array(‘key1’ => ‘value1’, ‘key2’ => ‘value2’) // use key ‘http’ even if you send the request to https://… $options = array(‘http’ => array( ‘method’ => ‘POST’, ‘content’ => http_build_query($data) )); […]