0

我有两个HttpHandlers。一个拦截 url 中的任何 pdf 文件请求,另一个拦截 xml 请求。在 pdf 文件处理程序中,我从中获取用户名,HttpContext.Current.User.Identity.Name但是当请求 xml 文件时HttpContext.Current.User.Identity.Name始终为空。

拦截处理程序的web.config部分如下所示:

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

认证部分

<authentication mode="Forms">
   <forms name="KFCSAUTH" loginUrl="login.aspx" protection="All" 
          slidingExpiration="true" path="/" domain=".scot.nhs.uk" />
</authentication>
<authorization>
    <allow users="?" />
</authorization>
<system.webServer>
   <!--<validation validateIntegratedModeConfiguration="false" />-->
   <handlers>
      <add name="Pallative Handler" path="/Pallative/*.xml" verb="GET" 
           modules="IsapiModule" 
           scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" 
           resourceType="Unspecified" requireAccess="Script" 
           preCondition="classicMode,runtimeVersionv2.0,bitness32" />
      <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" />
       <!--<add name="Pallative Handler" path="Pallative/pallative_doc.html" 
                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>
4

0 回答 0