impersonation

Continuation Task in the same thread as previous

扶醉桌前 提交于 2019-12-18 19:18:18
问题 I have an WebService that creates a task and a continuation task. In the first task we set Thread.CurrentPrincipal Hence, When the ContinuationTask starts it no longer has the Thread.CurrentPrincipal. I'd like to specify in the ContinuationTask that it should run in the same thread as its antecedent . I've searched the web but i only found the requirement for the thread to run in the SynchronizationContext, therefore i am starting to think I am missing some basic rule, specially regarding how

How can I temporarily impersonate a user to open a file?

自古美人都是妖i 提交于 2019-12-18 18:21:38
问题 I would like to temporarily impersonate a domain user account to read in a file on a network drive from an ASP.NET site. I would rather not set up impersonation for the entire site or set up a mapped drive on the server. 回答1: I ended up using code from Michiel van Otegem: WindowsImpersonationContext made easy and added an implementation of IDisposable. I found this in another question about impersonation in ASP.NET. Usage: using (WindowsImpersonationContextFacade impersonationContext = new

Can I impersonate a user on a different Active Directory domain in .NET?

送分小仙女□ 提交于 2019-12-18 16:51:37
问题 I have two Active Directory domains, A and B. Users in domain A need to run an application on their desktops to view and manipulate a resource located on a server in domain B. Each user also has an account in domain B. Is it possible to impersonate each user's domain B identity to perform operations on the domain B resource programatically? Example Workflow: User logs in to domain A. User launches desktop application. User specifies resource in domain B. Application prompts user for domain B

Impersonating users through NTLM

雨燕双飞 提交于 2019-12-18 11:57:53
问题 I have an internal application which has two levels of security. FormsAuthentication for client-facing application and NTLM Integrated authentication for management interface. I can easily impersonate clients by just creating the proper .ASPXAUTH cookie with the FormsAuthentication class' methods. However generating HTTP Authentication header for NTLM is beyond me so far. I had my hopes up when I found this article (http://msdn.microsoft.com/en-us/library/ms998358.aspx#paght000025

Impersonation and NetworkCredential

落爺英雄遲暮 提交于 2019-12-18 11:56:13
问题 I need to pass a NetworkCredential object with the credentials of the currently impersonated user to a web service from an asp.net application. My code looks like this: WindowsIdentity windowsIdentity = HttpContext.Current.User.Identity as WindowsIdentity; WindowsImpersonationContext context = windowsIdentity.Impersonate(); try { var client = GetClient(); client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; Log("WindowsIdentity = {0}", windowsIdentity

Impersonate with username and password?

只愿长相守 提交于 2019-12-18 10:56:08
问题 WindowsIdentity identity = new WindowsIdentity(accessToken); WindowsImpersonationContext context = identity.Impersonate(); ... context.Undo(); Where do i declare a administraotr UserName and Passowrd ? the accessToken param doesn't help me too much... Do I have to import DLL'S for it ? 回答1: You need to get the user's token. Use the p/invoke LogonUser from the advapi32.dll: [DllImport("advapi32.dll", SetLastError = true)] public static extern bool LogonUser( string lpszUsername, string

How to Impersonate a user for a file copy over the network when dns or netbios is not available [duplicate]

无人久伴 提交于 2019-12-18 02:43:46
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Accessing Password Protected Network Drives in Windows in C#? I have ComputerA on DomainA running as userA needing to copy a very large file to ComputerB on WorkgroupB which has the ip of 192.168.10.2 to a windows share that only userB has write access to. There is no netbios or dns resolving so the computer must be refrenced by IP I first I tried AppDomain.CurrentDomain.SetPrincipalPolicy(System.Security

How to Impersonate a user for a file copy over the network when dns or netbios is not available [duplicate]

女生的网名这么多〃 提交于 2019-12-18 02:43:19
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Accessing Password Protected Network Drives in Windows in C#? I have ComputerA on DomainA running as userA needing to copy a very large file to ComputerB on WorkgroupB which has the ip of 192.168.10.2 to a windows share that only userB has write access to. There is no netbios or dns resolving so the computer must be refrenced by IP I first I tried AppDomain.CurrentDomain.SetPrincipalPolicy(System.Security

How can I get elevated permissions (UAC) via impersonation under a non-interactive login?

删除回忆录丶 提交于 2019-12-17 16:45:10
问题 I have a class library that keeps system-wide configuration data in the registry (HKLM\Software\XXX). This library is used in various applications (services, windows forms, web apps, console apps) on various versions of Windows (XP, 2003, 7, 2008 R2). Because of this, the identity of the app is not consistent and may not even be a member of the machine's Administrators group. So I've created an AD domain admin user and do impersonation to gain write access to the registry. This works

How can I get elevated permissions (UAC) via impersonation under a non-interactive login?

你。 提交于 2019-12-17 16:45:05
问题 I have a class library that keeps system-wide configuration data in the registry (HKLM\Software\XXX). This library is used in various applications (services, windows forms, web apps, console apps) on various versions of Windows (XP, 2003, 7, 2008 R2). Because of this, the identity of the app is not consistent and may not even be a member of the machine's Administrators group. So I've created an AD domain admin user and do impersonation to gain write access to the registry. This works