私は2つ持っていHttpHandlers
ます。1 つは URL 内の任意の pdf ファイル リクエストを傍受し、もう 1 つは xml リクエストを傍受します。PDFファイルハンドラーでユーザー名を取得しますHttpContext.Current.User.Identity.Name
が、xmlファイルに対してリクエストが行われると、HttpContext.Current.User.Identity.Name
常にnullになります。
ハンドラーをインターセプトするセクションは次の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>