English 中文(简体)
how to get search engines to understand a DB driven asp.net site
原标题:

All,

This would seem like a fairly basic asp.net question - but in all my years of coding, I ve never really thought about it.

Say you have a asp.net 2.0 site with only a masterpage and a default.aspx and its a blog that saves all the data into the database. Links on the side are generated automatically. So ... the URL is always just http://www.XXXXX.com/default.aspx.

So, with that being the case, what do you need to do so that ... say google ... knows about all the different blog entries and links directly to the entries instead of just the base URL?

Is it as simple as changing the forms method to: method="get"?

Thanks, L. Lee Saunders

最佳回答

There are at least two solutions:

  1. Search engines understand query strings, so just add the article IDs to the URLs in your anchor tags -- no need to even use a form control.
  2. Use URL rewriting to expose one set of URLs to the outside world (like /article-title/1234/) in your anchor tags, and then modify the URL to be default.aspx when it arrives at your site; the page could then pull the article to be displayed from any number of places, including but not limited to a query string.
问题回答

You could have a REST webservice so that you can just use urls to navigate the site, and perhaps have a front page with some new posts, so that the spider can navigate the site..

As an example, look at the urls for SO, it is easy for a spider to navigate this database-driven website.

Create a page that just serves up XML Sitemap (the data obviously being pulled from your database) and submit the sitemap to Google.

Google will then index any links in your sitemap.

(This assumes that these is some difference between each article - e.g. a Querystring key/value).

Useful Link(s):

some sort of URL rewriting may be an answer

I wouldn t recommend a postback for your situation, it can get ugly for refreshes etc. So, yes, change the method to "get"

Then, say your page of, default.aspx?postid=12345 will get translated into /mm/dd/yy/this-is-my-post.aspx





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签