C# HttpContext.Current.User.Identity.Name在一个HttpHandler中为空,但在另一个HttpHandler中具有值

C# HttpContext.Current.User.Identity.Name在一个HttpHandler中为空,但在另一个HttpHandler中具有值,c#,asp.net,http,httphandler,C#,Asp.net,Http,Httphandler,我有两个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.Securi

我有两个
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>


domain=“.scot.nhs.uk”
中删除第一个点,使其成为
domain=“scot.nhs.uk”
,并告诉我是否有效。抱歉,这没有任何区别。我还要提到HttpContext.Current.User.Identity.Name的值是emtpy,而不是我在标题中输入的null。