<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx</link><description>A topic of discussion I've heard a few times when using Routing in ASP.NET concerns whether you should use the default generic route pattern for most of your controllers, or whether you should specify individual routes for every action. 
 (this applies</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx#10078324</link><pubDate>Wed, 20 Oct 2010 09:48:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10078324</guid><dc:creator>Henrik Stenbaek</dc:creator><description>&lt;p&gt;@simon: I&amp;#39;ve thought a little more and come to: if you want the clean url&amp;#39;s to profiles (http://localhost/Profile/Simon), a solution could be to let the crud operations have their own controller and route. In your example it would mean that ProfileEdit is moved to a new &amp;quot;ProfileAdm&amp;quot; controller&lt;/p&gt;
&lt;p&gt;routeCollection.MapRoute (&amp;quot;ProfileEdit&amp;quot;, &amp;quot;ProfileAdm/Edit&amp;quot;, new {controller = &amp;quot;ProfileAdm&amp;quot; action = &amp;quot;Edit&amp;quot;});&lt;/p&gt;
&lt;p&gt;routeCollection.MapRoute (&amp;quot;profile view&amp;quot;, &amp;quot;Profile / {username}&amp;quot;, new {controller = &amp;quot;Profile&amp;quot; action = &amp;quot;Show&amp;quot;, username = (string) null});&lt;/p&gt;
&lt;p&gt;and &amp;quot;my&amp;quot; new Clean function will then also be added to ProfileAdm controller and not on the Profile controller ;-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10078324" width="1" height="1"&gt;</description></item><item><title>re: Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx#10075463</link><pubDate>Wed, 13 Oct 2010 18:37:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10075463</guid><dc:creator>Simon J Ince</dc:creator><description>&lt;p&gt;@ Henrik - funnilly enough I used that example to call out that common mistake... and then failed to highlight it! So thanks :)&lt;/p&gt;
&lt;p&gt;It can be worse though, if the routes were the other way round, as it&amp;#39;d mean registering a specific username could prevent access to other functionality for others.&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10075463" width="1" height="1"&gt;</description></item><item><title>re: Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx#10074111</link><pubDate>Mon, 11 Oct 2010 13:38:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10074111</guid><dc:creator>Henrik Stenbaek</dc:creator><description>&lt;p&gt;Interresting article. I only see one problem eg. with the &lt;/p&gt;
&lt;p&gt;routeCollection.MapRoute(&amp;quot;ProfileView&amp;quot;,&amp;quot;Profile/{userName}&amp;quot;…&lt;/p&gt;
&lt;p&gt;when creating the solution one need to make sure at nobody is allowed to create a userName that equal ”Edit”. After putting the solution online and 20.000 users later. What if I want to add a profile route:&lt;/p&gt;
&lt;p&gt;routeCollection.MapRoute(&amp;quot;ProfileClean&amp;quot;,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;quot;Profile/Clean&amp;quot;,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;new { controller = &amp;quot;Profile&amp;quot;, action = &amp;quot;Clean&amp;quot; });&lt;/p&gt;
&lt;p&gt;now I need to make clear that nobody has signed up with the userName ”Clean” and so on, isn&amp;#39;t this kind of a problem? :-)&lt;/p&gt;
&lt;p&gt;/Henrik&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10074111" width="1" height="1"&gt;</description></item><item><title>re: Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx#9956851</link><pubDate>Tue, 02 Feb 2010 09:11:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9956851</guid><dc:creator>Simon J Ince</dc:creator><description>&lt;p&gt;@ Hadi;&lt;/p&gt;
&lt;p&gt;that's an interesting comment... I have to say I'm not sure I understand the benefit of autogenerating them over and above using some kind of generic pattern, or even your own route handler perhaps. Which makes what you say interesting! Any comments on why you chose that approach?&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9956851" width="1" height="1"&gt;</description></item><item><title>re: Generic or Specific Routes?</title><link>http://blogs.msdn.com/b/simonince/archive/2010/01/31/generic-or-specific-routes.aspx#9956630</link><pubDate>Mon, 01 Feb 2010 22:32:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9956630</guid><dc:creator>Hadi Hariri</dc:creator><description>&lt;p&gt;As part of a project I started, I went sown the route of auto-generating these routes at runtime along with conventions in place. Unfortunately due to other things popping up I didn't complete it entirely. If you're interested ping me and I'll show you what I have do far&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9956630" width="1" height="1"&gt;</description></item></channel></rss>