0

I have two HttpHandlers. One intercepts for any pdf file request in the url, the other for an xml request. In pdf file handler I get the username from HttpContext.Current.User.Identity.Name but when a request is made for xml file HttpContext.Current.User.Identity.Name is always null.

The web.config section to intercept the handlers looks like this:

<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 section

<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>
rumi
  • 3,293
  • 12
  • 68
  • 109
  • remove the first dot from `domain=".scot.nhs.uk"`, make it `domain="scot.nhs.uk"` and tell me if works. – Aristos Feb 03 '13 at 15:34
  • Sorry that does not make any difference. I shall also mention that the value for the HttpContext.Current.User.Identity.Name is emtpy instead of null as I put in the title. – rumi Feb 03 '13 at 18:06

0 Answers0