Using Protocol buffers v3 with ASP.NET core

By default ASP.NET core API methods operate on JSON: they deserialize JSON from request/response body to model type and back. JSON is everywhere and works well… unless you have very high throughput requirements. There are many alternative formats, but Google’s serialization format Protocol Buffers is one of the most used. It has overgone some changes recently: the old proto2 syntax is replaced with proto3. The latter even has an official C# support. The old proto2 used to have unofficial C# ports, and many ASP.NET MVC samples on the internet are based on those. I couldn’t find a working proto3 version, so I created my own. ...

March 11, 2016 · 3 min · Tero Teelahti

Azure Blob Storage CORS headers and ScriptCS

One of Basware’s products I work for uses CDN to deliver content for end users. CDN provider is Edgecast, and primary & secondary origins are Azure Blob storage accounts. So far we have not needed any cross domain access to the CDN, but now a new feature required Javascript requests from our application domain to the CDN domain… and browsers naturally block this nowadays. I knew right away that I need to set the Cross Origin Resource Sharing (CORS) headers to our origin servers, but setting this up was harder than it is supposed to be: Azure’s Powershell SDK does not have support to alter this value, and there is no UI to set it in the management portal. There is of course the management REST API you can use to do anything, but calling it with curl is hard due to the authentication scheme. Setting the DefaultServiceVersion property proved to be as complex before, so I knew what to expect. ...

May 29, 2015 · 2 min · Tero Teelahti

The promise of OWIN starts to materialize

OWIN stands for the “Open web interface for .NET”. Basically it is a reasonably simple specification that defines how data goes through the request pipeline, and how to attach to that pipeline. It is a specification for both the server and the application (middleware on OWIN’s terms) part. When I first saw the project I was not that convinced, but since then lots of applications that rely on OWIN and not the old System.Web stack has emerged, and also there are some hosting components that implement the spec. SignalR is a good example of middleware, and Katana a host. For me the new project Helios is also very interesting and I hope the project succeeds, as that would make hosting ASP.NET WebApi very lightweight. And light is never bad. ...

May 9, 2014 · 3 min · Tero Teelahti

Yet another take on Internet Explorer compatibility mode

I have touched this subject already twice: first I I blogged about forcing site rendering to be done with Internet Explorer’s latest engine. Then I faced a situation where separate intranet zone (bad idea, Microsoft!) fallbacks to compatibility mode and does not respect the IE=edge meta tag as internet zone web sites do. Well… the saga isn’t over, as I faced this situation at work today. Again. I was going to put the IE=11 meta tag in place to force normal mode, but then I started to doubt how older IE’s (9, 10) would interpret the “11” tag. Short answer is: they don’t. Luckily you can specify many different modes, and the browser will pick the first one it supports. To apply this use either a meta tag in your page: ...

February 4, 2014 · 1 min · Tero Teelahti

Techdays 2013 – SignalR

A week ago we had Microsoft TechDays 2013 at Finlandia Hall, Helsinki. For me this was fifth year in a row talking at Finnish Techdays; once I have talked about Azure, all the other talks have been about web technologies and trends. This time was no exception: I talked about real time web need and patterns, and about SignalR as one implementation tool. I enjoyed talking, and I hope I provoked at least some of the 200 listeners to think beyond the traditional HTTP Request/Response pattern we use to build web apps. ...

March 12, 2013 · 3 min · Tero Teelahti

Web site that narrates input text (for kids)

Last year, when my kids got interested in learning to read and write, I decided to do what I tend to do: bring technology to the table. I created a simple web site that narrates input text, and shows navigable history of the given input on the page. Simple narrating UI for kids. I created this on Finnish only, but changing the language is relatively easy (i.e. only a couple minutes work). If you wish to use this, I just put the source code on GitHub. If you wish to play with the Finnish version, I host it at http://lue.teelahti.fi. For my kids I put this full screen, and it kept them occupied for as long as half an hour (= eternity for kids).

January 30, 2013 · 1 min · Tero Teelahti

Problems with Internet Explorer compatibility view

A while ago I blogged about forcing site rendering to be done with Internet Explorer’s latest engine. This feature is very well documented by Microsoft. Not that well documented is that adding the X-UA-Compatible header with value “IE=edge” does only half of the job: it overrides document mode, but not browser mode, and therefore you might end with situation like below - even if you carefully tried to avoid it by placing the meta tag (I know, I just did). ...

January 17, 2012 · 2 min · Tero Teelahti

Disable Internet Explorer compatibility view via web.config

New Internet Explorers have a necessary (?) but annoying feature called “Compatibility view”. I do not need that in my sites since I try to keep my HTML in good shape. Therefore on all projects I want to disable the feature since usually it breaks the layout. Disabling compatibility view can be done by adding a meta tag to HTML head: <meta http-equiv="X-UA-Compatible" content="IE=edge" /> …or, as it turns out, by adding a custom HTTP header with the same content. This HTTP-header-way is much better for me as I can include it in my default web.config changes I use on almost every web project. ...

December 1, 2011 · 1 min · Tero Teelahti

How ASP.NET Web forms feels after 3 years of not using it

I have been an ASP.NET developer since it was invented, and a legacy ASP developer before that. For long I spent most of my time doing ASP.NET Web Forms and it was OK: I remember lots of weird problems that needed extensive trial and error –debugging, but things weren’t that bad. Then ASP.NET MVC came and I got interested. In the (massive) client project I worked for at that time I bent some Web forms concepts to the extreme and didn’t like it too much. MVC felt very light and as it embraced HTML it was very good for the new rising of HTML(5). ...

November 11, 2011 · 3 min · Tero Teelahti