2016-09-08 4 views
1

私はASP.NET WebフォームでWebポータルを構築しました。私は自分のページにインターネット上で検索可能にしたくないコンテンツ/ブログを持っています(プライベートにするだけでログインできます)。asp.netサイトコンテンツプライベート(インターネット上では検索できません)

私はどのように達成するべきですか?

+0

私は、データベースからコンテンツを取得し、要求に応じてページ上に表示されます。私のコンテンツは動的ではなく静的であるということです。 – sam

答えて

1

検索エンジンに特定のフォルダやコンテンツを無視するよう指示するrobots.txtファイルを追加できます。 例:robots.txtの

User-agent: * 
Disallow: /PrivateContent/ 
Disallow: /AdminStatistics.html 

この例では、フォルダ/PrivateContent、そしてAdminStatistics.htmlページ内の内容を無視してすべての検索エンジンに指示します。

もちろん、これは偶然のユーザー(またはrobots.txtファイルを意図的に検索するハッカー)をブロックしません。そのためには、web.configファイルによるアクセスを制限する方がよいでしょう。
例:web.configファイル

<Configuration> 
    <!-- This section block unauthenticated user access to the AdminStatistics.aspx page only. 
     It is located in the same folder as this configuration file. --> 
    <location path="AdminStatistics.aspx"> 
     <system.web> 
      <authorization> 
       <deny users="?" /> 
      </authorization> 
     </system.web> 
    </location> 
    <!-- This section blocks unauthenticated user access to all of the files that are 
     stored in the PrivateContent folder. --> 
    <location path="PrivateContent"> 
     <system.web> 
     <authorization> 
      <deny users="?" /> 
     </authorization> 
     </system.web> 
    </location> 
</configuration> 

https://support.microsoft.com/en-us/kb/316871からコピーしたコード)

関連する問題