Lower case URLs in ASP.NET MVC?

What's more, you should force any incoming requests that are uppercase to be redirected to the lowercase version. Search engines treat URLs case-sensitively, meaning that if you have multiple links to the same content, that content's page ranking is distributed and hence diluted Returning HTTP 301 (Moved Permanently) for such links will cause search engines to 'merge' these links and hence only hold one reference to your content Add something like this to your Global.asax. Cs file: protected void Application_BeginRequest(object sender, EventArgs e) { // Don't rewrite requests for content (.png, .

Css) or scripts (.js) if (Request.Url.AbsolutePath. Contains("/Content/") || Request.Url.AbsolutePath. Contains("/Scripts/")) return; // If uppercase chars exist, redirect to a lowercase version var url = Request.Url.ToString(); if (Regex.

IsMatch(url, @"A-Z")) { Response.Clear(); Response. Status = "301 Moved Permanently"; Response. StatusCode = (int)HttpStatusCode.

MovedPermanently; Response. AddHeader("Location", url.ToLower()); Response.End(); } }.

What's more, you should force any incoming requests that are uppercase to be redirected to the lowercase version. Search engines treat URLs case-sensitively, meaning that if you have multiple links to the same content, that content's page ranking is distributed and hence diluted. Returning HTTP 301 (Moved Permanently) for such links will cause search engines to 'merge' these links and hence only hold one reference to your content.

Add something like this to your Global.asax. Cs file: protected void Application_BeginRequest(object sender, EventArgs e) { // Don't rewrite requests for content (.png, . Css) or scripts (.js) if (Request.Url.AbsolutePath.

Contains("/Content/") || Request.Url.AbsolutePath. Contains("/Scripts/")) return; // If uppercase chars exist, redirect to a lowercase version var url = Request.Url.ToString(); if (Regex. IsMatch(url, @"A-Z")) { Response.Clear(); Response.

Status = "301 Moved Permanently"; Response. StatusCode = (int)HttpStatusCode. MovedPermanently; Response.

AddHeader("Location", url.ToLower()); Response.End(); } }.

Yes, just change it in the routing in the global. Asax file. @All asking if it matters: Yes I do think it matters.

Having the url all in lower case just looks better. Every time you don't make something look nice when you can, Bill Buxton kills a kitten.

Wow, Bill Buxton is HARSH! – SirDemon Apr 10 '09 at 21:32 I think anyone who has been to Mix or ReMix in the last 12 months has had to sit through Big Billy B's (admitedly quite interesting) rant on the importance of design needing to be baked in to a product. – IainMH Apr 12 '09 at 12:09.

You can do this by creating another Route class that inherits from GetVirtualPath and then create an extension method to add your new route class to the dictionary. goneale.wordpress.com/2008/12/19/lowerca....

What we really want is for the ASP.NET MVC routing system to simply only generate Urls of the lowercase variety. You could manually configure it to do so (or avoid convention and just name your controller/actions lowercase), but there’s a great little NuGet package that will take care of it for us! LowercaseRoutesMVC is a sweet little NuGet package by Lee Dumond that enforces lowercase Urls, doesn’t affect querstrings, and works with virtually zero configuration.

All you have to do after installing the package is to change your route registrations to call MapRouteLowercase instead of MapRoute. I just installed LowercaseRoutesMVC (the project page is on codeplex) and it’s working great!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions