2

.netframework 2.0でアプリケーションを作成し、3.5フレームワークで記述されたセキュリティプロジェクトで認証ハンドラーを使用しようとしています。また、IIS7を使用しています

アプリケーションのWeb.configには次のエントリがあります

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <handlers  accessPolicy="Read, Write, Script, Execute">

      <add name="Pdfhandler" verb="*" path="/calderdale/*.pdf" type="NES.HiLo.Security.CalderDaleAuthenticationHandler, NES.HiLo.Security" preCondition="integratedMode" />
  </handlers>

 </system.webServer>

CalderDaleAuthenticationHandlerのコードは次のとおりです。

using System;
using System.Web;

namespace NES.HiLo.Security
{
    public class CalderDaleAuthenticationHandler : IHttpHandler
    {
        /// <summary>
        /// You will need to configure this handler in the web.config file of your 
        /// web and register it with IIS before being able to use it. For more information
        /// see the following link: http://go.microsoft.com/?linkid=8101007
        /// </summary>
        #region IHttpHandler Members
    public bool IsReusable
    {
        // Return false in case your Managed Handler cannot be reused for another request.
        // Usually this would be false in case you have some state information preserved per request.
        get { return false; }
    }

    public void ProcessRequest(HttpContext context)
    {
        //var application = (HttpApplication)sender;
        //var context = application.Context;

        HttpRequest request = context.Request;
        HttpResponse response = context.Response;


      // Check if the user is authenticated

    }

    #endregion
}

}

私のアプリケーションには、calderdaleというフォルダー名があり、いくつかのpdfファイルがあります。以下のようなものを入力してPDFファイルにアクセスするとき。ブレークポイントを設定したハンドラーにコントロールが移動することを期待しています。コントロールがハンドラーに移動することはありません。助けていただければ幸いです。

http://local.knowledge.scot.nsh.uk/calderdale/abc.pdf

4

1 に答える 1

0

httphandlers を使用してリクエストをインターセプトしました。次に、このようなハンドラーを web.config に追加しました

<httpHandlers>
  <add verb="GET" path="calderdale/*.pdf"
   type="NES.HiLo.Security.CalderDaleAuthenticationHandler, NES.HiLo.Security" />
</httpHandlers>

IIS 7.0 で上記を行った後、IIS ハンドラー セクションから次のハンドラーを追加しました。

<system.webServer>  
  <handlers>
    <add name="Calderdale Handler" path="calderdale/*.pdf"
     verb="GET" modules="IsapiModule"
     scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
     resourceType="Unspecified" requireAccess="Script"
     preCondition="classicMode,runtimeVersionv2.0,bitness32" />
  </handlers>
</system.webServer>
于 2012-10-23T12:26:07.993 に答える