我有一个在 .netframework 2.0 中完成的应用程序,并尝试在一个安全项目中使用身份验证处理程序,它是用 3.5 框架编写的。我也在使用 IIS 7
应用程序的 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 文件时。我期待控件转到处理程序,在那里我设置了断点。控制永远不会交给处理程序。我很感激任何帮助。