Brian's Blog

items I see across my tribes

REST & .Net 4 Routing

April 22
by briancarter 22. April 2012 08:53

Doing some research - found this great article: http://www.4guysfromrolla.com/articles/012710-1.aspx

This hits on a problem I’ve been trying to address.  Problem:  developing a simple framework for doing REST based architectures in .Net.  I’ve used HTTP Handlers with ashx files.  This provides the simple approach but required you to handle all the routing (URL splitting).

With .Net 4,  routing is handled by the System.Web.Routing.  This allows a framework that provides routing for REST architectures while allowing the simple development of ASP.Net pages.  Sure, MVC & WCF provide more… but the cost is complexity.  If you need the extra features – go ahead and use them.  For the problems I deal with, I’ll take the simple and easy (quick) to understand (and code) approach.

In a nutshell, the framework I’m working on is using ASP.NET Routing which allows a developer to define routing rules, which map a route pattern - such as Categories/CategoryName - to a class that handles the request.  My classes are handled in HTTP Handlers.

Brian.

 

Download the code:

RoutingDemo40.zip (747.17 kb)

Categories: Development


 Questions or Feedback, my contact information is located on my About page.


The opinions, thoughts, and comments made in these blog posts are solely my own (unless otherwise stated). They do not reflect the opinions, thoughts or practices of my employer, my universities, my family, or anyone else. Also, I retain the right to change my mind about anything I publish here without having to go back and edit posts that occurred in the past. 

These are my opinions, or just as likely, someone else's opinions that I leveraged for my own.