I wasted an evening last night on a simple bug of mine. I was writing a simple HTML data entry page. I was using JSON + $.ajax to POST data to a ASP.NET MVC controller and it used to work. But for the life of me I couldn’t figure out what was wrong. Let’s start with some background.
I'd recently been asked by Chris Sells to help him with a simple WCF Data Services/jQuery example so I thought I'd share it via my blog as well. The basic idea is to use jQuery's AJAX functionality to retrieve JSON instead of the usual OData and consume it on a web page.
So as some of you know, I’ve spent a lot of the last year working on a web project. I’ve been using ASP.NET MVC3 and it’s going well. I am at the point where we are creating the mobile apps. I service them, I need an API (which will eventually be available as a public API too). I had started creating using MVC and simple routes but I was urged to look at the new Web API stack that is installed with the new ASP.NET MVC4 installer.
Web API is a pretty sexy REST stack (though others are cool too). As I’ve been talking about it a lot lately, the biggest question by far is authentication and authorization. There are many options including OAuth, Token-based authentication, basic authentication, and even custom solutions. One option that should be included is to use your existing ASP.NET Forms-Based Authentication.
As a preview to my recently released course on ASP.NET Web API, we’ve released a clip that shows you how to piggy-back on ASP.NET Authentication to protect your Web API interfaces:
|Intro to Font Awesome 5 (Free Course)|
|Bootstrap 4 by Example (Coming Mar 1, 2018)|
|Vue.js by Example (Coming May 1, 2018)|
|Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.0)|
|Using Visual Studio Code for ASP.NET Core Projects (new)|
|Implementing and Securing an API with ASP.NET Core|
|Building a Web App with ASP.NET Core, MVC6, EF Core and AngularJS|
|Building a Web App with ASP.NET5, MVC6, EF7, and AngularJS (Retired)|
|Best Practices in ASP.NET: Entities, Validation, and View Models|
|Front-End Web Development Quick Start|
|Lessons from Real World .NET Code Reviews|
|Node.js for .NET Developers|
|Application Name||WilderBlog||Environment Name||Production|
|Application Ver||18.104.22.168||Runtime Framework||.NETCoreApp,Version=v2.0|
|App Path||D:\home\site\wwwroot\||Runtime Version||.NET Core 4.6.26020.03|
|Operating System||Microsoft Windows 10.0.14393||Runtime Arch||X86|