Collection Form Post Parameters in WebAPI Controller

image.png

There are lots of ways using ASP.NET MVC4 to collection passed in form parameters (POST) to the WebAPI Controller.  I’m not wanting to create a Model, I’m not wanting to get involved with dynamic variables, I just want the values that are posted in.  Say for example, my post looks like the following: To capture both sessionId and trackId, I can have a WebAPI controller in Visual Studio that looks just like this: namespace WebAPI.Api{ public class SessionRpcController : ApiController { [HttpPost] [ActionName("UpdateSessionTrack")] [Authorize(Roles = "admin")] public HttpResponseMessage PostUpdateSessionTrack( FormDataCollection formDataCollection) … Continue Reading

Why ReSharper Is Worth Using (reason #879)

image.png

  I often email the folks at JetBrains (the makers of ReSharper) letting them know that one of their refactors is wrong.  They often email me back letting me know my about my misunderstanding.  I actually enjoy this. Today, was a perfect example but I did not get past the ReSharper feedback form when I realized my code was wrong (sadly missed the exchange with them).  I’m busy writing the SEO save for Silicon Valley Code Camp’s new web site (coming by next week hopefully).  In this case, I’m looking for a trackId passed into the sessions.aspx page. If I find it, then I redirect to a more friendly URL. Here is my code I was going to complain to ReSharper about as incorrectly warning me that my trackId = –1; is … Continue Reading

ImageResizer, Amazon’s CloudFront and ASP.NET’s MVC4 Razor Helper Methods

image.png

  Well, the title is certainly a mouthful and hopefully a honey trap for SEO.  The thing is, I’m really going to talk about all those things.  I just went through a short exercise that I thought would be useful to share. Background For Silicon Valley Code Camp, I use the toolkit ImageResizer written by  Nathanael Jones.  For those of you that deal with any quantity of images on their web sites, I strongly recommend taking a look at this.  Before I used this toolkit I written my own image handlers that did some similar things but not nearly as well or with so many features.  One of the issues we have on code camp is that we try and show lots of pictures all the time.  Sponsors and speakers are … Continue Reading

Building a Simple REST Controller with Microsoft Visual Studio 2012 and WebAPI

image.png

Three Part Series (Part 1)   Building a Simple REST Controller with Microsoft Visual Studio 2012 and WebAPI Using Sencha ExtJS 4.2 and Sencha Architect 2.2, Build a Simple REST client (to feed WebAPI server) Add CRUD to REST client for calling Microsoft WebAPI server   REST can be a very loaded term that brings up lots of discussions of what it means.  Just to mention a few sites that define it take a look at this list: http://kellabyte.com/2011/09/04/clarifying-rest/ http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven http://stackoverflow.com/questions/3821663/querystring-in-rest-resource-url What is abundantly clear is there is not … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: