开发者

SEO Friendly URLs in Webforms vs MVC

From what I understand MVC has more SEO friendly urls. Or at least it is easier to achieve.

Is the reason for this that you can make fake folders that are actually arguments like:

question/37/WhatIsSEO

Where the equivilent Webforms would be question.aspx?id=37&title=WhatIsSEO

Where the title doesn't actually do anything, it is just there for SEO...

Does it rank what looks like folders higher than arguments? Is that why it is superior or am I completely off base?

If I am not, what is the best solution to combat t开发者_如何学JAVAhis as a webforms developer?


The same routing used by ASP.NET MVC can be used in ASP.NET Web Forms if you are using .NET 3.5 SP1 (or 4.0) and IIS 7:

http://msdn.microsoft.com/en-us/magazine/dd347546.aspx http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx


Easiest way is to add a http module to your current webforms project.

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

This shows you the basics of it, But it can easily be expanded so that the pages you want to rewite is taken from a database or even built on the fly.


  • Shorter Urls simply just look better.
  • Users are more likely to remember the Url and link to your site giving you better Page Rank.
  • Yes, WebForms developers can and should take advantage of the Routing.
  • These Urls are perceived to rank higher than querystring based Urls, but who knows for sure. This Google blog article suggests sometimes querystings are better than static looking Urls.
  • Below is a small snippet of code in your global.asax file to make it work. The entire solution is more involved but very doable.

    routes.Add("qId", new Route("question/{id}", new CustomRouteHandler ("~/Question.aspx")));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜