Wednesday, 11 November 2015

A potentially dangerous Request.Form value was detected from the client. MVC

From MVC3 onwards if you see this message

A potentially dangerous Request.Form value was detected from the clien

you can fix it by decorating the model propery with this:


Thursday, 5 November 2015

Xcode bypass App Transport Security

During development it's common that we need to access resources within an iOS app from a non-secure server. To enable this we need to bypass Apple's new App Transport Security. We can do this by adding the following to the info.plist file:


Wednesday, 14 October 2015

Testing Apple Push APNS

Today I've been trying to get some .net code working on a server using PushSharp to send messages via APNS. I've used this code before and it all works fine, and is still in production for a major app, running every ten minutes. For some reason my new cut of the code wasn't working, and I needed some way to work out whether something was wrong with this implementation or perhaps something was wrong with the Device Token I was sending to APNS.

Enter Pusher, an app that runs on your Mac and allows you to fire messages to devices from your desktop either via the sandbox or production server.

This proved to be very useful as within ten minutes I'd established that it was my device token at fault - it seems in that even in my dev environment running my app on my phone from Xcode I was interacting with the Production APNS system rather than the expected sandbox system, and so when sending we should have been using the production certificate.

Tuesday, 13 October 2015

Disabling webview bouncey overscroll in Cordova

To stop the whole app being subject to a bouncy overscroll just ensure these are in your config.xml :

 <preference name="webviewbounce" value="false" />
 <preference name="DisallowOverscroll" value="true" />

Tuesday, 29 September 2015

Adding WinMerge as your merge tool in SourceTree

Set the merge tool to custom and use this command:
C:\Program Files (x86)\WinMerge\WinMergeU.exe
With these arguments:
-e -u -dl "Mine" -wr -dr "Theirs" $LOCAL $REMOTE $MERGED
Taken from this SO answer

Wednesday, 23 September 2015

Cordova WP8 System.SystemException

I just lost hours diagnosing the following error:

CordovaBrowser_LoadCompleted Apache Cordova native platform version 3.8.1 is starting Exception thrown: 'System.SystemException' in

I replaced 'execScript' with 'eval' where Browser.InvokeScript was called, as suggested here. This didn't make things better. I also replaced the XHRHelper code with code written by Marius Seimanovs, as suggested here. No joy. I removed all my plugins. Still no dice.

So I setup a new blank WP8 cordova project and worked backwards, trying to break it by introducing my own pre-existing code that was already working in iOS, Android and locally on a Win machine.

I discovered that I had a poorly formatted Content-Security-Policy meta tag. That's all it was! I'd missed off the closing quote from the content attribute, and this brought it all crashing down.

The missing quote!