Googlebot 可以访问 MVC2/3 ChildActionOnly 控制器方法吗?

发布于 2024-11-30 00:32:43 字数 981 浏览 0 评论 0原文

如果这个问题已经有几个月了,并且我认为我在应用程序的早期版本中向 Googlebot 展示了该控制器方法。但最近添加了新的 - LatestNews 还标有 [ChildActionOnly] 属性

问题 Elmah 有时会捕获以下异常:

The action 'LatestNews' is accessible only by a child request.

Connection: Keep-alive Accept: */* Accept-Encoding: gzip,deflate From: googlebot(at)googlebot.com Host: soldiez.com User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

我有以下操作声明(当然有点简化)

[ChildActionOnly]
public virtual ActionResult LatestNews()
{
   var data = DataManager.CollectNews();
   return PartialView( data );
}

并且 View 被这样调用:

<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" runat="server"><%   
   Html.RenderAction( MVC.Home.LatestNews() );
%></asp:Content>

我想知道谷歌如何找到该子操作。我从未部署过没有 ChildActionOnly 的版本,

如果有任何帮助,我将不胜感激!

If have this issue for already several months and thought that I showed to Googlebot in early versions of app that controller method. But recently added new one - LatestNews also marked with [ChildActionOnly] attribute

Problem
Elmah sometimes catching the following exception:

The action 'LatestNews' is accessible only by a child request.

from

Connection: Keep-alive Accept: */* Accept-Encoding: gzip,deflate From: googlebot(at)googlebot.com Host: soldiez.com User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

I have the following action declaration (a bit simplified of course)

[ChildActionOnly]
public virtual ActionResult LatestNews()
{
   var data = DataManager.CollectNews();
   return PartialView( data );
}

and View is called like that:

<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" runat="server"><%   
   Html.RenderAction( MVC.Home.LatestNews() );
%></asp:Content>

I'm wondering how google could find that child action. I have never been deployed version without ChildActionOnly

I would be appreciate for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山人契 2024-12-07 00:32:43

我不会太担心这一点 - 最主要的是 ChildAction 属性按预期工作。

此类问题通常是由于贪婪的路由和错误的链接造成的。您可以下载 Glimpse(来自 nuget),这样您就可以准确地看到正在匹配的路线,但这不会帮助您找到可能输入错误的链接(可能指向您的子操作)。

I wouldn't worry about this too much - the main thing is that the ChildAction attribute is working as expected.

Issues like this are often the result of greedy routes and mistyped links. You could download Glimpse (from nuget) so you can see exactly what routes are being matched but this won't help you find links that may have been mistyped (perhaps pointing to your child action).

落日海湾 2024-12-07 00:32:43

AFAIK,Google Bot 不知道任何服务器语言术语。他只向你的服务器发送一个请求,然后处理返回的响应(只包括 Html、js 等)。除非您手动公开它,否则他不知道您的子操作的 url。

AFAIK, Google Bot does not know anything any server language jargons. He only send a request to your server and then play with the returned response(which just include Html, js etc). He does not know about the url of your child action unless you have manually expose it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文