Jian,
Thank you for your reply. Unfortunately, the code you
provided below will not work with my app because I am
using Forms Authentication and User.Identity is returning
a System.Web.Security.FormsIdentity object. So I tried
using the following code:
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As
System.Security.Principal.WindowsIdentity
currentWindowsIdentity = WindowsIdentity.GetCurrent()
impersonationContext =
currentWindowsIdentity.Impersonate()
This seems to work without errors and
WindowsIdentity.GetCurrent() returns the account I am
specifiying in Web.config, but I still recieve Permission
Denied, the same error as before.
I did some more reading on the Impersonate() method and
there is an example using LogonUser, similar example from
the article you sent me. I tried it but received the same
results. Then looking in the documentation, the sample
there states:
' This sample demonstrates the use of the WindowsIdentity
class to impersonate a user.
' IMPORTANT NOTES:
' This sample can be run only on Windows XP. The default
Windows 2000 security policy
' prevents this sample from executing properly, and
changing the policy to allow
' proper execution presents a security risk.
I am using Windows 2000 Server and so are all of my
customers. Have you tried these examples with Windows
2000 Server?
Lastly, the LogonUser API documentation states it cannot
authenticate users against a remote computer, just the
local computer. I am running Active Directory and all my
customers are as well.
Any other ideas to work around this issue?
Thank you very much for your time,
George
>-----Original Message-----
>Dear George,
[quoted text clipped - 21 lines]
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
"leolin" - 21 Nov 2003 13:08 GMT
Dear George,
Would you like to share your code to me so I can reproduce in my sode.
My email address is jslin@microsoft.com
Thanks
Jian Shen
This posting is provided "AS IS" with no warranties, and confers no rights.
"leolin" - 27 Nov 2003 07:36 GMT
Hi George,
This is security issue; I test your code in my Win2003.
You need to add the user that running the IIS process to your administrator
group. It works very well in my side.
If you use Win2000, you can try to add ASPNET your local administrator
group to test, you can start the task manager to find which user running
the process.
By the way, you need to restart the IIS to test when change the permission,
sometime it will not refresh automatically.
When you find it works, then you need to impersonate the user tat works.
Thanks
Jian Shen
This posting is provided "AS IS" with no warranties, and confers no rights.