impersonation

Process.Start() impersonation problem

这一生的挚爱 提交于 2019-11-26 23:18:08
问题 Trying to start process with another access token, without success, it runs as the non-impersonated user. using (WindowsIdentity identity = new WindowsIdentity(token)) using (identity.Impersonate()) { Process.Start("blabla.txt"); } How to make this work properly? 回答1: You need to set the ProcessStartInfo.UserName and Password properties. With UseShellExecute set to false. If you only have a token then pinvoke CreateProcessAsUser(). 回答2: Try this example from http://msdn.microsoft.com/en-us

Impersonate Domain User with Integrated Pipeline

浪尽此生 提交于 2019-11-26 22:34:36
问题 In an local Intranet environment, are we doomed to use "Classic" pipeline mode in our App Pool if we want to use Impersonate our Windows domain users, or is there a new way to declaratively "run as" them (so-to-speak)? My goal is to use Windows Authentication for local web applications on my Intranet so users can authenticate and run apps under their active directory account (principle). Every time I try this (Using the NetworkService identity of course), I get this error: 回答1: I wrote a

Can I turn off impersonation just in a couple instances

人盡茶涼 提交于 2019-11-26 22:33:52
I have an app that has impersonation used throughout. But when a user is logged in as an admin, a few operation require them to write to the server itself. Now if these users do not have rights on the actual server (some don't) it will not let them write. What I want to do is turn off impersonation for just a couple commands. Is there a way to do something like this? using(HostingEnvironment.Impersonate.Off()) //I know this isn't a command, but you get the idea? Thank you. Make sure the Application Pool do have the proper rights that you need. Then, when you want to revert to the application

Open a shared file under another user and domain?

放肆的年华 提交于 2019-11-26 21:04:37
问题 I have a C# console application that needs to read a shared file on a machine in another domain. When the application tries to access the file an exception occurs as the local user does not have permission to access the shared resource. Currently I overcome this problem manually by open the shared folder from the run and put the username and password into the windows authentication dialog then run the application. How can I do it programmatically? 回答1: a) p/invoke LogonUser with LOGON32_LOGON

Impersonate user in Windows Service

泪湿孤枕 提交于 2019-11-26 20:13:46
问题 I am trying to impersonate a domain user in a windows service with the service logged in as the Local System Account. So far, I am only able to get this to work by logging the service and set the process using the user credentials, like the following. ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = CommandDetails.Command; startInfo.WorkingDirectory = Settings.RoboCopyWorkingDirectory; startInfo.Arguments = commandLine; startInfo.UseShellExecute = false; startInfo

How to Start/Stop a Windows Service from an ASP.NET app - Security issues

一曲冷凌霜 提交于 2019-11-26 19:20:47
问题 Here's my Windows/.NET security stack: A Windows Service running as LocalSystem on a Windows Server 2003 box. A .NET 3.5 Website running on the same box, under "default" production server IIS settings (so probably as NETWORKSERVICE user?) On my default VS2008 DEV environment I have this one method, which gets called from the ASP.NET app, which works fine: private static void StopStartReminderService() { ServiceController svcController = new ServiceController("eTimeSheetReminderService"); if

How can I fix the Kerberos double-hop issue?

ぃ、小莉子 提交于 2019-11-26 18:49:30
I'm having some trouble calling a web service from within a web application and I was hoping someone here might be able to help. From what I can tell, this seems to have something to do with the Kerberos double-hop issue . However, if it is, I'm not sure what to do to actually fix the problem. To make things harder, I don't have the proper permissions to make changes to Active Directory accounts, so I need to know what to ask for when requesting changes. In my situation, I need to pass the credentials (Integrated Windows Authentication) from a web application onto a backend web service so that

Run ExeCommand in customAction as Administrator mode in Wix Installer

江枫思渺然 提交于 2019-11-26 18:17:57
问题 I am new to wix installer. I have developed a set-up using wix installer for my application and I need to execute a Custom Action to run a command in cmd.exe. In XP it works fine. But in Windows 8 & 7 the cmd prompt needs to be run as administrator. I have googled and found the keywords Elevated Privileges and impersonate might help me. <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"></Package> As you can see above, I used the

Impersonation in ASP.NET MVC

末鹿安然 提交于 2019-11-26 17:36:16
I have a MVC web application on an intranet and want to be able to create files on our FTP server to send to outside partners. The code for impersonation uses the WindowsImpersonationContext. System.Security.Principal.WindowsImpersonationContext impersonationContext; impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate(); StreamWriter sw = System.IO.File.CreateText("PathOnFTPServer"); sw.Write("data"); impersonationContext.Undo(); Here's what's happening and the reason for my question: Pre Impersonation User.Identity.Name: [my windows credentials]

ASP.NET Impersonate in .NETFramework 2 VS .NETFrameWork 4

坚强是说给别人听的谎言 提交于 2019-11-26 17:22:10
问题 We have an ASP.NET Site in .NetFramework 2 (with App Pool 2 Classic in IIS 7.5), We use mixed Authentication with Basic Authenticate and Form Authenticate . The Configuration in IIS is: And have specific user in Anonymous Authentication named: Guest . When The user Login with another username like Admin we use impersonate: string Token = GetSpecificTokenOfCurrentUser(); System.Security.Principal.WindowsIdentity WinUser = (WindowsIdentity) HttpContext.Current.Application["User_"+Token];