• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 912
  • Last Modified:

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"
0
jrking1978
Asked:
jrking1978
  • 2
  • 2
1 Solution
 
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
 
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")
0
 
RobinSoftware EngineerCommented:
Ok. Sorry the example didn't help.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now