I want to have an internal website that automatically authenticates users based on their network credentials. However, I want to have the website display image files that are in a directory that most domain users do not have read access to. I have created a user that does have read access to the directory, and made the website run in an app pool with that user identity, but it appears that the file is being read as the domain user, since only users that have read access themselves can see the image on the website. Is there a way to force the image load to happen as the app pool user, without turning on anonymous authentication for the website (which would potentially allow non-domain users to access the site)?
I ended up creating a handler that does the image loading, and just made the image source a path to that handler (with an encrypted query string specifying the actual file). That way the actual loading is happening as the app pool user.