Flow statements in React and JSX

Attempting to use an if statement in JSX will quickly be met with lots of resistance. For instance, trying to conditionally render some content like so: <div> { if(true) { <div>some conditional text</div> } } </div> This will generate errors by the JSX transpiler. As discussed in the React docs, this is because JSX transpiles into a series of JavaScript function calls and object creation, where you can’t legally use an if statement.

Accessing the Http Request’s body from HttpActionExecutedContext

If you have ever tried to directly access the body of a Http request on a POST or PUT in Web Api, you might have run into some roadblocks. Unlike the MVC pipeline, Web Api accesses the request of the body through a stream for performance reasons. Once the stream is read during the model binding phase, the stream is at the end, and if you try to read it at a later time, you might notice the body is just a blank string.

Authenticating with SharePoint Online in an Ionic/Angular/PhoneGap app

I am working on a side project to update lists in a SharePoint online instance. The project is a hybrid mobile app using PhoneGap and the Ionic framework. I have been playing around with Ionic for a couple of months now, and so far I am really enjoying it. For starters, it uses AngularJS, which is my fav MV* framework of the moment. Also, Ionic provides great tooling to help you build and package up your app.

Ending the debug session in Visual Studio 2013 Preview kills IISExpress, and how to fix it

It seems that by default when you end the debugging session of an ASP.Net app in Visual Studio 2013 Preview, it will kill the IISExpress instance as well. This is fairly annoying as my workflow usually involves leaving the browser window open and just doing a new build, and then refreshing the browser. Fortunately it was an easy fix, all you need to do is go the the project properties for the web application, go to the web tab, and uncheck “Enable Edit and Continue”.

About

Hi, my name is Ely and I am a Denver based software developer, speaker, and writer. I do a lot of work around rich web applications in the Microsoft stack, and am exploring other frameworks/languages such as Node and Python. I also dabble a bit in Android and iOS development both natively and through hybrid PhoneGap apps. I run the Boulder .Net user group, and have been known to organize a conference or two.

Error running Node JS in IISExpress and IISNode

I recently started playing around with Node JS, and have been going through TekPub’s BackBone JS tutorials (which uses Node for the backend). � In the tutorial, Rob uses Webmatrix on Windows8, and I followed along, however, I ran into a problem the first time I tried to run the site using IISExpress and IISNode: “The iisnode module is unable to start the node.exe process. Make sure the node.exe executable is available at the location specified in the� system.

MVC4 Quick Tip #4–Updating a model the HTTP way with ASP.Net Web API

Disclaimer: This code is based on MVC 4 Beta 1, and might change in future releases. The www.asp.net/web-api website has a few good videos and decent examples, however, I didn’t notice a concrete way of doing an update using ASP.Net Web API.� So I thought I would quickly document how I implemented it for anyone else looking how to do so, and will welcome any comments or suggestions if I am going about this the wrong way.

MVC4 Quick Tip #3–Removing the XML Formatter from ASP.Net Web API

ASP.Net Web API provides a powerful new feature called content negotiation that will automatically format of your requests based on what the client asks for.  For instance, if the client sends ‘application/xml’ in the Content-Type HTTP header, then the format of your response will be XML.  The two default formatters included in Web API are the XML formatter, and the JSON formatter. The beauty of the automatic content negotiation is that you don’t need to write any code to map your models into these formats, it is taken care of for you by the formatters.

MVC4 Quick Tip #2–Use Delegates to setup the Dependency Resolver instead of creating a Dependency Resolver class

I’m a big fan of cutting out unneeded or unnecessary code, so here is a tip that isn’t new in MVC4, but I just discovered it and thought it was really cool and worth sharing.  When using IOC in MVC, you setup a class that implements IDependencyResolver, which has methods to return services for a given type.  While these classes where simple, it always seemed like a bit of ceremony was required whenever starting up a new MVC app.

MVC4 Quick Tip #1–Put your API Controllers in a different folder to avoid class naming collisions

This post is the start of a series of quick tips for Asp.Net MVC 4, which was released in beta form last week.  You can find out more about MVC4 and download the beta from www.asp.net/mvc/mvc4. Disclaimer: This code is based on MVC 4 Beta 1, and might change in future releases. MVC 4 ships with the new Asp.net Web APIs, which allow you to create RESTful services from within your web projects (Web Forms or MVC).