I have a legacy WebForms application that consumes (ASP.net) Web-Services (using anonymous access) that reside on the same IIS server (same domain, different apps each with their own dedicated app pool). This application was hosted in a secured VPN but now there is a request to host it publicly.
What is the expedient (yet secure) method to secure the web services site without doing a substantial re-coding (on the application level). I have tried configuring the Web-Service site in IIS so that it enables only the Service account (Identity) under which the Web Applications App Pool runs but the current request mode coming from the application is always using Anonymous access. I need to restrict access to allow only the this specific web application. I am thinking of an ISAPI filter, but it is not recommended for IIS 7+ ?
ADDENDUM: I would love to find an IIS based solution. Currently I am trying to restrict access based to just the Web Application source. Problem is (as stated) is those request are all "Anonymous" if I could make those requests use "Network Service" or some other local Identity then I would be set.
After more research I have settled on an
http Module
Solution, as it has the following benefits:• Minimal Coding
• No need to modify existing code base
• Easy deployment
• Follows existing
ASP.Net
security models for (Local access)The Module (VS:DLL Project)
Implementation
Add the compiled DLL (
FilterModule.dll
) to the Web Service (site)bin
Directory.Add the following to module definition in the Web Service (or site) configuration file (web.config)
in the
<system.webServer>
section under<modules>
add the following: