gok*_*ter 7 asp.net seo googlebot
我正在努力确定我们的Asp.net网站没有被搜索引擎索引的原因 - 整个网站.当我使用谷歌的"获取Googlebot"工具时,它会抛出以下错误.我确保我的网站可以禁用会话(即在web.config中设置sessionMode ="Off"),我已经在网上搜索过,但仍然没有运气.
这是我从googlebot得到的错误:
HTTP/1.1 302 Found
Date: Thu, 02 Dec 2010 23:05:49 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: /ErrorPage.aspx?aspxerrorpath=/Default.aspx
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 168
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fErrorPage.aspx%3faspxerrorpath%3d%2fDefault.aspx">here</a>.</h2>
</body></html>
Run Code Online (Sandbox Code Playgroud)
我自己找到了答案。
使用前请务必检查 Request.UserLanguages != null 。另外,请确保 CurrentCulture 设置为有效的默认值。这两项检查的原因是机器人不使用 Request.UserLanguages - 它始终为空。浏览器确实使用Request.UserLanguages。换句话说:如果 Request.UserLanguages 为 null,则不要设置 CurrentCulture。
问题是这样的:
我网站中的所有 aspx 页面均继承自 System.Web.UI.Page 的自定义基类。除非您使用仅针对机器人引发异常的代码覆盖 OnLoad() 或 init 事件,否则这不是问题。我的 OnLoad() 事件中有这行代码:
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
当从浏览器访问 aspx 页面时,此代码非常有效。呃!谁不会使用浏览器...?答案:googlebot 和所有其他机器人。
如何检查 googlebot 在索引您的网站时是否存在问题:
| 归档时间: |
|
| 查看次数: |
1278 次 |
| 最近记录: |