Archive for March, 2008

31 Mar 2008

Force MVC Route URL to Lowercase

16 Comments Uncategorized

So one of my pet peeves in web development is mixed case URL’s. And I usually make sure that all my URL’s in my personal projects follow this standard. I also believe, contrary to my URL case standard, that my code should follow standards .NET naming techniques, such as Pascal casing for my method names.

These two naming standards come in to conflict with MVC because the name of the action method in the controller is used in its native Pascal case. Which generates URL’s that look like this:

/Home/Index
/Home/About

However I want them to be generated like this:

/home/index
/home/about

So I developed my own Route based off of the System.Web.Routing.Route to force everything to lowercase.

public class LowercaseRoute : System.Web.Routing.Route
{
	public LowercaseRoute(string url, IRouteHandler routeHandler) 
		: base(url, routeHandler) { }
	public LowercaseRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler) 
		: base(url, defaults, routeHandler) { }
	public LowercaseRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler) 
		: base(url, defaults, constraints, routeHandler) { }
	public LowercaseRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler) 
		: base(url, defaults, constraints, dataTokens, routeHandler) { }

	public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
	{
		VirtualPathData path = base.GetVirtualPath(requestContext, values);

		if (path != null)
			path.VirtualPath = path.VirtualPath.ToLowerInvariant();

		return path;
	}
}

For anybody as anal as me about stupid stuff such as casing of URL’s you should find this class up above a welcomed addition to your MVC projects.

31 Mar 2008

Very Informative Rap On HTML Coding Design

1 Comment Uncategorized

I got a kick out of this video I found on YouTube. Take a look:

30 Mar 2008

Now With WordPress 2.5

No Comments Uncategorized

I have upgraded my blog to WordPress 2.5. It is a very nice piece of software that the WordPress development team has done a great job on. Some of the new features include:

  1. Cleaner, faster, less cluttered dashboard
  2. Dashboard Widgets
  3. Multi-file upload with progress bar
  4. Bonus: EXIF extraction
  5. Search posts and pages
  6. Tag management
  7. Password strength meter
  8. Concurrent editing protection
  9. Few-click plugin upgrades
  10. Friendlier visual post editor
  11. Built-in galleries

The upgrade this weekend turned up a Cookie bug in my URL Rewriter and Reverse Proxy software, that I use to host WordPress on my Windows 2003 server. There will be an updating to the URL Rewriter coming soon to MSDN Code and Codeplex as well as a release on my companies website.