私は古いクラシック ASP Web サイトに取り組んでおり、いくつかの PDF ドキュメントを含むディレクトリがあります。ユーザーがログインするまで、直接リンク (www.example.com/example.pdf) を介して上記の pdf ドキュメントにアクセスできないようにする方法はありますか? もしそうなら、どうすればいいですか?
4 に答える
Password protection on the page listing your documents will not prevent direct access to the documents. For example if your documents are listed by folder view or are linked from any web page then every search engine and spider on the planet already knows the document's location in your site. So here's what you can do...
Start by moving the document folder to below root level, then use FileSystemObject to deliver the document. For documents over 2-4 Mb you should deliver them in "chunks".
Now you can add a condition to your download script to verify the user's log-in status or redirect to log-in. Your comment link will now look something like:
http://somesite.com/load-pdf.asp?id=mydocuent.pdf
If you were providing a list of documents by folder view you can still do that using FileSystemObject.
ASPには、そのディレクトリのweb.configの数行でアクセスを制御するメンバーシッププロバイダーが組み込まれていますか?
http://msdn.microsoft.com/en-us/library/yh26yfzy%28v=vs.80%29.aspx
次の Microsft の記事では、従来の ASP を使用して特定のページへのアクセスを保護する方法について説明しています。
簡単な ASP コードを使用して ASP ページをパスワードで保護する方法
ここに追加のリンクがいくつかあります。どちらも ASP.NET 用ですが、おそらく従来の ASP でも同じ考え方を使用できます。
スレッド: Web サイトのサブフォルダーをパスワードで保護して、匿名アクセスを拒否するにはどうすればよいですか?
同様の記事は次のとおりです:フォーム認証によるフォルダーの保護
あなたの Web サイトにはすでにログイン インフラストラクチャがあると思います。
そうでない場合は、最初に追加する必要があります | http://www.evolt.org/node/28652 .
次に、ページを作成し、保護したいリソースの場所に配置します。http://youwebsite.com/dir1/dir2/file.pdf
たとえば、に置き換えhttp://yourwebsite.com/dir1/dir2/getfilepdf.asp
ます。
新しいスクリプトで、ユーザーがログオンしたかどうかを確認し、そうでない場合はログオン ページに送り返します。ユーザーが正しく認証されている場合は、ファイルを読み取り、.xml を使用してブラウザーに返しますResponse.BinaryWrite
。
ウェブはサンプルでいっぱいです。これを読む | http://support.microsoft.com/kb/307603。