Server 阻止网络爬虫在搜索结果中索引和显示pdf文件

Server 阻止网络爬虫在搜索结果中索引和显示pdf文件,server,configuration,Server,Configuration,我正试图阻止网络爬虫为网站上的pdf文件编制索引。我知道如何使用.htaccess文件执行此操作,但不知道如何在web.config文件中执行此操作。此代码段将阻止爬虫为整个站点编制索引正确吗?为了阻止对PDF进行爬网,我需要什么 <httpProtocol> <customHeaders> <add name="X-Robots-Tag" value="noindex" /> </

我正试图阻止网络爬虫为网站上的pdf文件编制索引。我知道如何使用.htaccess文件执行此操作,但不知道如何在web.config文件中执行此操作。此代码段将阻止爬虫为整个站点编制索引正确吗?为了阻止对PDF进行爬网,我需要什么

<httpProtocol>
    <customHeaders>
        <add name="X-Robots-Tag" value="noindex" />
    </customHeaders>
</httpProtocol>