Hi
I am trying to retrieve scheduled tasks from our remote server, but i'm getting an "Access is denied" exception.
I am trying to access the tasks from a website on IIS 7 on Windows Server 2008.
I have tried the following:
1) Plain
Why is impersonation ignored?
I am trying to retrieve scheduled tasks from our remote server, but i'm getting an "Access is denied" exception.
I am trying to access the tasks from a website on IIS 7 on Windows Server 2008.
I have tried the following:
1) Plain
var ts = new TaskService("RemoteServerName");
2) Use impersonationvar identity = HttpContext.Current.Request.LogonUserIdentity;
WindowsImpersonationContext impersonation = identity.Impersonate();
var ts = new TaskService("RemoteServerName");
impersonation.Undo();
-
The exception occurs when trying to initialize a new TaskService.
-
When trying to access the scheduled tasks on the local server (the server where the website is hosted) I get no errors, but can only retrieve all tasks if I use impersonation.
-
If I test the same code in the Visual Studio (and IIS Express), it works fine (even without impersonation).
Why is impersonation ignored?