I am using the azure-mobile-apps-net-server SDK for my smartphone app backend. Now I want to show the smartphone user some message, when there is a new update available. My idea is to include the current version number of the smartphone app in the header of the request, which goes to the backend.
Now I can read the version in the backend, compare it to some value and throw an HttpResponseException, which the client will catch. Then I can show the client user some message to update to a newer version.
Here some pseudocode:
public void ValidateClientVersion()
{
var version = request.header["X-Client-Version"];
if (version != 3.2.1)
throw new HttpResponseException(...);
}
Now my problem I have multiple Actions in multiple TableControllers. I think there must be some very simple way to call ValidateClientVersion() before any of the Actions is called. I don't want to add the method call in every single Create, Update, Delete, ... Action.
However as I am new to ASP.Net? or what ever the azure-mobile-apps-net-server Framework is called, I don't know this simple solution.
Can someone point me in the right direction?
Action filtersis what you are looking for asp.net/mvc/overview/older-versions-1/controllers-and-routing/… - Mitul