Development

Upcoming ASP.NET MVC posts

January 20, 2010 · 1 min read

Most of this may or may not be relevant to your situation but after completing development, staging, and most of the production implementation of an ASP.NET MVC site I wanted to share some of what I learned.

The majority are one or two-off hacks from someone else's code or a down/upgrade where appropriate, creating a Frankenstein. These won't necessarily be in order I don't think.

  • Homepage - various jQuery plugins & content fetching
  • Content/ structure
  • Elmah

    • Code version: 1.1.11517.2009
    • Downgraded ELMAH_LogError stored procedure to SQL 2000
    • ELMAH_LogError pruning taken from 2 blog posts from a single source
  • Editing 1:1, 1:M or M:M in Entity Framework
  • Validation with xVal and DataAnnotations - straight up from the samples
  • Image/Link/CSS/JScriptHelpers - using tagbuilder to eliminate a lot of code in markup
  • jQuery uses

    • Delete links - tweak of an Http Delete implementation
    • Ajaxy Http Post/Gets
    • Image rollover
    • Google analytics
    • TinyMCE
  • Areas

    • Views/Web.config copied from main project
    • T4MVCAdmin fork to handle Links and Controller references (that is now quite old)
  • SQL 2000 from 2005

    • nvarchar(max) to nvarchar(4000) - ntext is more of a 1:1 mapping but it meant significant stored proc changes
    • using SqlPubWiz
  • MsBuild scripts - dependency chaining, SqlPubWiz integration via Community Tasks, etc.

    • Database
    • Web

I'll try to refer to this verbatim as my defacto outline and even that isn't quite structured correctly enough. It'll work itself out as the posts are made I'm sure. I'm using this to hopefully keep me motivated to completing them all.

ASP.NET MVC and CreateArea Extension Method on Restricted Hosting

January 19, 2010 · 1 min read

I've recently switched hosting providers at the company I work for. Instead of being able to use wildcard mapping or the .mvc file extension mapping, I'm left with .aspx.

The premise of this exercise is easily explained here: http://www.asp.net/learn/mvc/tutorial-08-cs.aspx, specifically Listing #3 under the Hosted Server section.

While this is fine for a default MVC1 project, I've currently implemented Phil Haack's Areas v1 prototype with Steve Sanderson's CreateArea extension method located here http://blog.codeville.net/2008/11/05/app-areas-in-aspnet-mvc-take-2/.

To make the Global.asax change from Listing #3 in the first link (phew), you need to modify all routes to add the .aspx extension. The same goes true for .mvc.

I followed Steve's example verbatim and eliminated the default "" (blank) route because isn't necessary in wildcard mapping. What isn't readily apparent is that you absolutely need this when you do get into file extensions.

The fix is a simple but because it felt like the same route/area I didn't think it would work.

routes.CreateArea("Root", "Namespace.Controllers",
    routes.MapRoute(null, string.Empty,
    new { controller = "Home", action = "Index", id = string.Empty })
);

RouteDebug confirmed it gets hit properly so that should be all you need. I haven't tested to see whether you can just add this route and leave it for both file extension and wildcard mapping but it shouldn't be a problem to just add it and leave it.

IT'S HEREING!!!!

January 18, 2010 · 1 min read

Technically it's still comming!!! but I wanted my first post to officially thank Richard Dodsworth aka "Conkerjo" of Sgt. Conker for letting me host my blog and domain on his equipment. Without such a generous gesture, none of this would be possible.

I also wanted to take the time to pimp Sgt. Conker for its XNA goodness as I play a very small roll in keeping it together. There are a number of admins on the back-end in addition to Conkerjo, like Björn Graf (boki), Catalin Zima (CatalinZ), (Cryovat), Casey Young (ElementCy), and Michael Coles (X-Tatic). It is following the tradition of ziggyware.com in trying to be a great aggregate of XNA information and I must say it is doing a great job for a site that is primarily user-driven. If you've contributed to a ziggyware article in the past and would like that content on Sgt. Conker, or would just like to contribute something new, send an email to articles@sgtconker.com. To be clear, Sgt. Conker isn't trying to 1up or replace ziggyware outright but we're trying to capture as much of the great content that is still relevant.