Sometimes you need to send JSON instead of an HTTP form post, but this doesn't work when you're using ASP.NET's AntiForgeryTokens. In this short post you'll learn how you can use jQuery to automatically send form data as JSON along with an ASP.NET AntiForgeryToken. Then to top it all off, you'll create a custom token validation attribute to protect your web application from CSRF attacks.
I've been working on a Windows Phone and Windows 8+ app that interacts with a JSON API. This API sends images over the wire as a base64 string which I then need to convert to an image and display it to my users. However, it's not quite as easy to do in a WinRT app as it is in any other XAML program. I'm posting it here for posterity.
I had to join a bunch of parameters into an HTTP form post and send to an external API. I've done it before, but I can never seem to get it right on the first try. Instead of Googling around and piecing together a few different StackOverflow questions, I'm just going to post it here for posterity.