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 ASP.net

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"
jrking1978Asked:
Who is Participating?
 
jrking1978Connect With a Mentor Author 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")
0
 
RobinSoftware EngineerCommented:
Please have a look at http://support.microsoft.com/kb/248187

This will explain how to impersonate a user from Active Server Pages.
0
 
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.
0
 
RobinSoftware EngineerCommented:
Ok. Sorry the example didn't help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.