Questions tagged [impersonation]

Impersonation is a process whereby an application assumes another identity or security context during execution.

1522 questions
5
votes
0 answers

After impersonating a domain user on windows, an app running as administrator cannot load the profile

I'm trying to load the user profile (using LoadUserProfile - http://msdn.microsoft.com/en-us/library/windows/desktop/bb762281%28v=vs.85%29.aspx) but the API fails when the user is a windows domain user. The application runs with an Administrative…
5
votes
2 answers

How to impersonate another user?

I'm working on an ASP.net app and i'm trying to impersonate a user I'm creating a windowsIdentity with a token WindowsIdentity winId = new WindowsIdenty( token ); this token was got by calling the un managed code [DllImport("advapi32.dll")] public…
DJPB
  • 5,429
  • 8
  • 30
  • 44
5
votes
2 answers

Impersonation on remote service says Login failed for user 'NT Authority\Anonymous Logon'

I have a service that I want to when accessing databases I want to access databases to use the calling identities credentials. Before I access a particular database I do an impersonation by var winId = HttpContext.Current.User.Identity as…
TheWommies
  • 4,922
  • 11
  • 61
  • 79
5
votes
2 answers

Impersonation: ASP.Net MVC Controller Action vs. Web Forms

Is there a difference with impersonation between an ASP.Net MVC controller actions vs. an ASP.Net Web Form? Using the exact same code within the same web project, I am able to successfully impersonate the Windows user when connecting to SQL Server…
SaaS Developer
  • 9,835
  • 7
  • 34
  • 45
5
votes
1 answer

How to impersonate Farm Administrator in server object model?

We are using SharePoint Foundation 2010. We are creating content database and site collection using server object model. We have more than 1000 users in SharePoint. As content database and site collection creation are administartive task, only farm…
5
votes
2 answers

Why is exception from impersonated code not caught?

My C# code uses impersonation by calling Win32 functions via P/Invoke internal class Win32Native { [DllImport("advapi32.dll", SetLastError = true)] public static extern int ImpersonateLoggedOnUser(IntPtr token); …
sharptooth
  • 167,383
  • 100
  • 513
  • 979
5
votes
6 answers

Ethics & Impersonation: Alternatives?

Have you ever troubleshoot for your customer and ask (or really want to) their credentials to check their settings if the fault is there? Our solution to this is to implement impersonation feature to login as any users and have access to everything…
syaz
  • 2,659
  • 6
  • 36
  • 44
5
votes
1 answer

Why do DOS devices defined in an impersonated session not appear in Explorer

I have a Windows service running under the Local System account that creates DOS devices using the DefineDosDevice function. The service is running on a W2K8 Remote Desktop Server. If the devices are created using the service's credentials, they are…
FishesCycle
  • 1,011
  • 1
  • 10
  • 24
5
votes
1 answer

Impersonation, Active Directory, and "user does not have authority to xxxx" issues

I have 2 ASP.NET MVC 3 applications. I am using impersonation via the web.config to allow me to query Active Directory to get details on the user. The application uses Windows authentication and does not allow anonymous users. One application is the…
jason
  • 2,219
  • 5
  • 33
  • 66
5
votes
3 answers

How to run PowerShell scripts from C#

I am trying to run a PowerShell script with C#, but I don't have any success. Here is my function: private void ExecutePowerShellCommand(string scriptfile) { RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create(); …
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
5
votes
1 answer

Pass credentials from one wcf service to another wcf service

I have 2 wcf services both hosted on IIS on the same machine. Service A is called by a client and uses BasicHttpBinding with transport security and NTLM credentialtype. Service A needs to call service B which is also hosted on IIS but uses…
ghost
  • 141
  • 8
5
votes
1 answer

Logon failure: the user has not been granted the requested logon type at this computer

I have a website in which I create a file and save it in a remote share folder. I have a account which have write access to that share folder. So I impersonate that account while saving the file in that path. This logic works when I run the…
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
5
votes
3 answers

Impersonation in ASP.NET web application does not work when running on IIS

I am working on ASP.NET 4.0 MVC3 web application that works in intranet environment. The application makes use of Windows authentication. Its application pool is run by domain user that has spn set on a domain controller. Authentication works using…
5
votes
2 answers

Network Connected Printer not available in ASP.Net Application

I have an ASP.Net 4.0 web application running on IIS 7.5, I can get the list of installed printers using System.Drawing.Printing.PrinterSettings.InstalledPrinters command and assign each report in the application to any printer listed above! There…
Kamyar Nazeri
  • 25,786
  • 15
  • 50
  • 87
5
votes
1 answer

Using advapi32.dll:LogonUserA() to impersonate a remote machine's local user

I need to be able to run RegLoadKey() on a remote machine, and it may be that my machine and the remote machine are not in the same domain. If they are, the below code works OK and I can impersonate a user that has admin privileges on the machine.…
JCCyC
  • 16,140
  • 11
  • 48
  • 75