How to impersonate a user for the session

I have an asp app. I want to store some pdf documents in a folder that I have disabled anonymous access. Right now when I go to the folder I get a prompt for a user and password. I have already authenticated them via my own app. I would like to pass or impersonate a user account for the that folder. I need to be for the whole session. how would I accomlish this. This is not

I have been trying this code, but when I go to the folder I still get a prompt:

     Dim objLogon

     ' create an object for impersonating IIS to use a valid domain user instead of anonymous user IUSR_machinename
     Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")

     ' any domain user who has rights to access active directory
     objLogon.Logon "USERNAME", "PASSWORD", "DOMAIN"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobinSoftware EngineerCommented:
Please have a look at

This will explain how to impersonate a user from Active Server Pages.
jrking1978Author Commented:
That is what the code is from above. I have a page outside the folder that I have secured. It has a link to a file inside that folder. I out the above code on the page to force it to log in. When I load the page, I do not get an error. but when I click the link to go to the file inside the secure folder I get the pop up prompt asking me for my username and password.
jrking1978Author Commented:
I ended up using a streaming object and put the file on my server in a place that was not being published

Set objStream = Server.CreateObject("ADODB.Stream")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobinSoftware EngineerCommented:
Ok. Sorry the example didn't help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.