Using Web API as a proxy for downloading files

Imagine this scenario: an ApiController Action that acts as a proxy to an external CDN for downloading files (yes, even large ones). The basic idea here is to use HttpClient to create an async request to the CDN passing also the optional range headers and then simply return the result...

5 minute read

Adding a custom MediaTypeFormatter to your WebAPI project

This is going to be easy. As many of the other posts of this blog, even this entry is due to an issue I was forced to face, this time with the marvelous IE8 😀 In a nutshell, I have a WebAPI project returning some nice json data. Everything works...

2 minute read

How to reference an array of scripts from another script in Unity

Just a quick and dirty tip (actually, more of a reminder for myself), probably there’s a better way but for now it worked for me… Basically in Unity I needed a quick way to reference a list of scripts from another script. The idea is to have a “main” script...

1 minute read

Multilanguage searching with Elasticsearch

This time I’ll start directly with the code.  First an utility method to create the connection: [csharp] private ElasticClient Connect(IEnumerable contents) { var defaultLanguageCode = “eng”; var uri = new System.Uri(ConfigurationManager.AppSettings[“ElasticSearchServer”]); var settings = new ConnectionSettings(uri).SetDefaultIndex(defaultLanguageCode); var client = new ElasticClient(settings); } [/csharp] And here’s the interesting part: [csharp] public...

1 minute read