<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Custom routing for ASP .NET MVC</title>
	<atom:link href="http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/</link>
	<description>Getting the job done with .NET</description>
	<lastBuildDate>Thu, 09 Sep 2010 14:56:27 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mike</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-7612</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 30 Jul 2010 05:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-7612</guid>
		<description>There is another good way of routing customization that allows to pass Controller/Action/View names inside JSON data
http://vitana-group.com/article/microsoft-.net/route-handling</description>
		<content:encoded><![CDATA[<p>There is another good way of routing customization that allows to pass Controller/Action/View names inside JSON data<br />
<a href="http://vitana-group.com/article/microsoft-.net/route-handling" rel="nofollow">http://vitana-group.com/article/microsoft-.net/route-handling</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koistya `Navin</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-6679</link>
		<dc:creator>Koistya `Navin</dc:creator>
		<pubDate>Wed, 03 Feb 2010 23:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-6679</guid>
		<description>Register routes by using attributes on controller methods.

http://maproutes.codeplex.com/

Example:

[Route(&quot;product/{name}&quot;)]
[RouteDefault(&quot;name&quot;, &quot;&quot;)]
[RouteConstraint(&quot;name&quot;, &quot;^[0-9]+_&quot;)]
public ActionResult Product(string name)
{
    return View();
}</description>
		<content:encoded><![CDATA[<p>Register routes by using attributes on controller methods.</p>
<p><a href="http://maproutes.codeplex.com/" rel="nofollow">http://maproutes.codeplex.com/</a></p>
<p>Example:</p>
<p>[Route("product/{name}")]<br />
[RouteDefault("name", "")]<br />
[RouteConstraint("name", "^[0-9]+_&#8221;)]<br />
public ActionResult Product(string name)<br />
{<br />
    return View();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How ASP.NET MVC WORKS? &#171; MVC#</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-6554</link>
		<dc:creator>How ASP.NET MVC WORKS? &#171; MVC#</dc:creator>
		<pubDate>Sun, 03 Jan 2010 16:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-6554</guid>
		<description>[...] Custom Routing for ASP.NET MVC [...]</description>
		<content:encoded><![CDATA[<p>[...] Custom Routing for ASP.NET MVC [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codingcockerel</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-4525</link>
		<dc:creator>codingcockerel</dc:creator>
		<pubDate>Sun, 12 Jul 2009 18:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-4525</guid>
		<description>Hi Adam, thanks for your reply, it&#039;s always good when people suggest a better way and this certainly looks a lot simpler than my initial version. Good work!</description>
		<content:encoded><![CDATA[<p>Hi Adam, thanks for your reply, it&#8217;s always good when people suggest a better way and this certainly looks a lot simpler than my initial version. Good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Tibi</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-4522</link>
		<dc:creator>Adam Tibi</dc:creator>
		<pubDate>Sun, 12 Jul 2009 15:35:24 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-4522</guid>
		<description>Hi

I know that you have written this a long ago, but it is still worth mentioning how to improve it.

I intially started by following your steps, but I noticed that this could be even simpler by ONLY creating a custom RouteHandler using the following code:

public class CustomRouteHandler : IRouteHandler {

public IHttpHandler GetHttpHandler(RequestContext requestContext) {
    RouteData routeData = requestContext.RouteData;
    routeData.Values.Add(&quot;controller&quot;, GetControllerName(routeData));
    return new MvcHandler(requestContext);
}

}

And use the following with your RouteMap ( on application start)

routes.Add(
    &quot;Custom&quot;,
    new Route (
        &quot;{useCaseNoun}/{useCaseVerb}/{action}/{id}&quot;,
        new RouteValueDictionary(new {action = &quot;Index&quot;, Id = &quot;&quot;}),
        new CustomRouteHandler()
    )
);</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I know that you have written this a long ago, but it is still worth mentioning how to improve it.</p>
<p>I intially started by following your steps, but I noticed that this could be even simpler by ONLY creating a custom RouteHandler using the following code:</p>
<p>public class CustomRouteHandler : IRouteHandler {</p>
<p>public IHttpHandler GetHttpHandler(RequestContext requestContext) {<br />
    RouteData routeData = requestContext.RouteData;<br />
    routeData.Values.Add(&#8221;controller&#8221;, GetControllerName(routeData));<br />
    return new MvcHandler(requestContext);<br />
}</p>
<p>}</p>
<p>And use the following with your RouteMap ( on application start)</p>
<p>routes.Add(<br />
    &#8220;Custom&#8221;,<br />
    new Route (<br />
        &#8220;{useCaseNoun}/{useCaseVerb}/{action}/{id}&#8221;,<br />
        new RouteValueDictionary(new {action = &#8220;Index&#8221;, Id = &#8220;&#8221;}),<br />
        new CustomRouteHandler()<br />
    )<br />
);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Avinash</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-820</link>
		<dc:creator>Avinash</dc:creator>
		<pubDate>Wed, 11 Feb 2009 11:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-820</guid>
		<description>good article</description>
		<content:encoded><![CDATA[<p>good article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://codingcockerel.co.uk/2008/05/26/custom-routing-for-asp-net-mvc/comment-page-1/#comment-394</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Tue, 04 Nov 2008 16:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://codingcockerel.co.uk/?p=20#comment-394</guid>
		<description>Nice. Will be giving this a blast.</description>
		<content:encoded><![CDATA[<p>Nice. Will be giving this a blast.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
