简体   繁体   English

在C#MVC中检测主要搜索引擎的最佳方法

[英]Best way to detect major search engines in C# MVC

I found the following question but if possible I don't want to have to make changes that will affect all sites on the server. 我发现了以下问题,但如果可能的话,我不想进行会影响服务器上所有站点的更改。 HttpBrowserCapabilities.Crawler property .NET HttpBrowserCapabilities.Crawler属性.NET

I also found instructions on using the browserCaps Element http://msdn.microsoft.com/en-us/library/sk9az15a.aspx but it seems to be deprecated. 我还找到了有关使用browserCaps元素http://msdn.microsoft.com/en-us/library/sk9az15a.aspx的说明,但它似乎已被弃用。

What is the easiest way to detect the major search engines in Asp.net 4.0? 在Asp.net 4.0中检测主要搜索引擎的最简单方法是什么?

(I am only really interested in being able to detect major search engines) (我只对能够检测主要搜索引擎感兴趣)

Just the same way as you would in a normal ASP.Net site. 就像在普通ASP.Net站点中一样。

        if( Request.Browser.Crawler )
        {

        }

You can add an httpmodule to do detection on all requests. 您可以添加httpmodule来检测所有请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM