<?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: Lowercase Route URL&#039;s in ASP.NET MVC</title>
	<atom:link href="http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/</link>
	<description>Graham O&#039;Neale – Deep In .NET Development: ASP.NET, MVC, jQuery, WPF, WCF, Silverlight</description>
	<lastBuildDate>Wed, 10 Mar 2010 13:27:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Pleun</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-5999</link>
		<dc:creator>Pleun</dc:creator>
		<pubDate>Mon, 25 Jan 2010 14:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-5999</guid>
		<description>Great article, thank you so much :)</description>
		<content:encoded><![CDATA[<p>Great article, thank you so much <img src='http://goneale.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muhammad Asad Firoze</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-1246</link>
		<dc:creator>Muhammad Asad Firoze</dc:creator>
		<pubDate>Wed, 29 Jul 2009 22:29:23 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-1246</guid>
		<description>Thanks Graham for the code. It helped me resolve the case-insensitive duplicate content issue. But it caused another problem. When you visit the website without any page mentioned. It will show the name of the landing page in the URL. I tried to remove that landing page from the URL before redirecting, but it didn&#039;t work. Please see if there is any fix for it.</description>
		<content:encoded><![CDATA[<p>Thanks Graham for the code. It helped me resolve the case-insensitive duplicate content issue. But it caused another problem. When you visit the website without any page mentioned. It will show the name of the landing page in the URL. I tried to remove that landing page from the URL before redirecting, but it didn&#8217;t work. Please see if there is any fix for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham O'Neale</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-27</link>
		<dc:creator>Graham O'Neale</dc:creator>
		<pubDate>Mon, 23 Feb 2009 23:24:54 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-27</guid>
		<description>@Celik: You know what Celik, this code needs to be re-worked, what happened was I originally was running with this RegEx and a different if statement (I believe from here http://stackoverflow.com/questions/170900/how-can-i-avoid-duplicate-content-in-asp-net-mvc-due-to-case-insensitive-urls-and), but ran in to issues with my QueryString being converted to lowercase also, which was undesirable.  So what I do now, for all requests is ToLower() the Url and append the QueryString in original casing.

The old code was:
            // If upper case letters are found in the URL, redirect to lower case URL.
            if (Regex.IsMatch(HttpContext.Current.Request.Url.ToString(), @&quot;[A-Z]&quot;) == true)
            {
                string LowercaseURL = HttpContext.Current.Request.Url.ToString().ToLower();

                Response.Clear();
                Response.Status = &quot;301 Moved Permanently&quot;;
                Response.AddHeader(&quot;Location&quot;, LowercaseURL);
                Response.End();
            }

You can see there that the entire URI including QS is converted to lower, so if you have a URL like localhost/my/page/list/2?CategoryID=40 you may want to keep CategoryID in this casing.
I can&#039;t recall where I needed my QS to remain in correct casing but it was a problem at the time.
I will update the code sample with an actually useful Global.asax :) &lt;em&gt;(This has been done!)&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>@Celik: You know what Celik, this code needs to be re-worked, what happened was I originally was running with this RegEx and a different if statement (I believe from here <a href="http://stackoverflow.com/questions/170900/how-can-i-avoid-duplicate-content-in-asp-net-mvc-due-to-case-insensitive-urls-and)" rel="nofollow">http://stackoverflow.com/questions/170900/how-can-i-avoid-duplicate-content-in-asp-net-mvc-due-to-case-insensitive-urls-and)</a>, but ran in to issues with my QueryString being converted to lowercase also, which was undesirable.  So what I do now, for all requests is ToLower() the Url and append the QueryString in original casing.</p>
<p>The old code was:<br />
            // If upper case letters are found in the URL, redirect to lower case URL.<br />
            if (Regex.IsMatch(HttpContext.Current.Request.Url.ToString(), @&#8221;[A-Z]&#8220;) == true)<br />
            {<br />
                string LowercaseURL = HttpContext.Current.Request.Url.ToString().ToLower();</p>
<p>                Response.Clear();<br />
                Response.Status = &#8220;301 Moved Permanently&#8221;;<br />
                Response.AddHeader(&#8220;Location&#8221;, LowercaseURL);<br />
                Response.End();<br />
            }</p>
<p>You can see there that the entire URI including QS is converted to lower, so if you have a URL like localhost/my/page/list/2?CategoryID=40 you may want to keep CategoryID in this casing.<br />
I can&#8217;t recall where I needed my QS to remain in correct casing but it was a problem at the time.<br />
I will update the code sample with an actually useful Global.asax <img src='http://goneale.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <em>(This has been done!)</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Celik</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-25</link>
		<dc:creator>Celik</dc:creator>
		<pubDate>Fri, 20 Feb 2009 15:16:10 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-25</guid>
		<description>if (Regex.IsMatch(lowercaseURL, @&quot;[A-Z]&quot;) == true)
this is nor correct i believe. Cause we will never go into the if statement even if url is not lowercase. We are using our lowercaseurl for checking uppercase characters which will never be true.

Something like this works fine:
if (Regex.IsMatch(HttpContext.Current.Request.Url.AbsoluteUri, @&quot;[A-Z]&quot;) == true)</description>
		<content:encoded><![CDATA[<p>if (Regex.IsMatch(lowercaseURL, @&#8221;[A-Z]&#8220;) == true)<br />
this is nor correct i believe. Cause we will never go into the if statement even if url is not lowercase. We are using our lowercaseurl for checking uppercase characters which will never be true.</p>
<p>Something like this works fine:<br />
if (Regex.IsMatch(HttpContext.Current.Request.Url.AbsoluteUri, @&#8221;[A-Z]&#8220;) == true)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Smith &#187; Generating and enforcing that any link and request is lowercase with ASP.NET MVC</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-26</link>
		<dc:creator>Luke Smith &#187; Generating and enforcing that any link and request is lowercase with ASP.NET MVC</dc:creator>
		<pubDate>Sun, 01 Feb 2009 18:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-26</guid>
		<description>[...] post is based off 2 other blog posts I found which helped me come up with my solution with some slight modifications on their [...]</description>
		<content:encoded><![CDATA[<p>[...] post is based off 2 other blog posts I found which helped me come up with my solution with some slight modifications on their [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graham O'Neale</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-24</link>
		<dc:creator>Graham O'Neale</dc:creator>
		<pubDate>Sun, 11 Jan 2009 22:56:13 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-24</guid>
		<description>Thanks Josh!

Really glad you&#039;ve found it useful.  I try to update it regularly, so feel free to drop by anytime.  I also have an RSS feed you can use any feed reader to subscribe to if you like @ http://goneale.wordpress.com/feed.

I&#039;ll actually make a hyperlink for that right now!</description>
		<content:encoded><![CDATA[<p>Thanks Josh!</p>
<p>Really glad you&#8217;ve found it useful.  I try to update it regularly, so feel free to drop by anytime.  I also have an RSS feed you can use any feed reader to subscribe to if you like @ <a href="http://goneale.wordpress.com/feed" rel="nofollow">http://goneale.wordpress.com/feed</a>.</p>
<p>I&#8217;ll actually make a hyperlink for that right now!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-23</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Sun, 11 Jan 2009 14:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-23</guid>
		<description>First of all congratulation for such a great site. I learned a lot reading here today. I will make sure i visit this site more often so I can learn more.

&lt;a href=&quot;http://yiyd.com&quot; rel=&quot;nofollow&quot;&gt;Make your long Urls shorter - Free Url redirection - Hide your affilate URLS&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>First of all congratulation for such a great site. I learned a lot reading here today. I will make sure i visit this site more often so I can learn more.</p>
<p><a href="http://yiyd.com" rel="nofollow">Make your long Urls shorter &#8211; Free Url redirection &#8211; Hide your affilate URLS</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: grahamoneale</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-22</link>
		<dc:creator>grahamoneale</dc:creator>
		<pubDate>Tue, 30 Dec 2008 23:13:21 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-22</guid>
		<description>Hi Terry,
That&#039;s fine.  I might as well keep your comment, makes my blog look busy ;)
It is one built in to wordpress I found. Simply encapsulate your code in tags like this:
[sourcecode language=&#039;language-here&#039;]
hello!
[/sourcecode]
More info and languages that can be used can be found here:
&lt;a href=&quot;http://support.wordpress.com/code/5/&quot; rel=&quot;nofollow&quot;&gt;http://support.wordpress.com/code/5/&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hi Terry,<br />
That&#8217;s fine.  I might as well keep your comment, makes my blog look busy <img src='http://goneale.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
It is one built in to wordpress I found. Simply encapsulate your code in tags like this:<br />
[sourcecode language='language-here']<br />
hello!<br />
[/sourcecode]<br />
More info and languages that can be used can be found here:<br />
<a href="http://support.wordpress.com/code/5/" rel="nofollow">http://support.wordpress.com/code/5/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Terry Donaghe</title>
		<link>http://goneale.com/2008/12/19/lowercase-route-urls-in-aspnet-mvc/comment-page-1/#comment-21</link>
		<dc:creator>Terry Donaghe</dc:creator>
		<pubDate>Tue, 30 Dec 2008 21:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://goneale.wordpress.com/?p=84#comment-21</guid>
		<description>Hi Graham.  This may be a really lame question, but what plugin, etc are you using here to display your code?  I will be setting up a wordpress.com coding blog in the near future and would like this functionality.  Feel free to email me the answer and then delete this comment.

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Graham.  This may be a really lame question, but what plugin, etc are you using here to display your code?  I will be setting up a wordpress.com coding blog in the near future and would like this functionality.  Feel free to email me the answer and then delete this comment.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
