impersonation

Line numbers missing from exception stack trace when ASP.NET impersonation enabled

删除回忆录丶 提交于 2019-12-08 08:34:51
问题 An ASP.NET 2.0 web application has been compiled with PDB symbols, deployed to a server running IIS 6. In the web.config, user impersonation is enabled: <identity impersonate="true" /> When an Exception is thrown, the stack trace is missing line numbers, making it very difficult to determine exactly where the exception is emanating from. eg. System.NullReferenceException: Object reference not set to an instance of an object. at MyApp.ReportingServices.WebForm.DA.AmoRepository.GetDimensions

How can I pass logged on user details from ASP.Net web app to WCF service?

删除回忆录丶 提交于 2019-12-08 05:57:43
问题 I have 2 web applications: one is an ASP.Net web app and the other is an ASP.Net WCF web services application. I want to the web app to the WFC web app's consume services. Eventually, these 2 apps will be communicating over a firewall. I want the user to log on to the client web app using forms authentication, authenticated by the wcf service, and then to be able to access service resources based on his roles. So far I have managed to log on using System.Web.ApplicationServices

Help Understanding Impersonation

随声附和 提交于 2019-12-08 04:12:30
问题 I was looking for a way to Start / Stop Windows Services residing in a remote machine using C# code, and found the following code sample. It works fine for me. It is coded using Impersonation Technique, which apparently requires both the machines (let's say A and B) have a user account with the same UserName + Password combination. int LOGON32_LOGON_INTERACTIVE = 2; int LOGON32_PROVIDER_DEFAULT = 0; private bool impersonateValidUser(String userName, String machineName, String passWord) {

Extending a Jhipster JWT (Spring) monolith application to support impersonation

你离开我真会死。 提交于 2019-12-08 03:33:01
问题 I have generated a jhipster angular/java application that is using JWT authentication. I now want to extend the application to support impersonation. I am interested in achieving the following: Impersonation by admin : Allowing the admin user to login as any other user Impersonation granted to user: Allowing another user that has been granted the right to impersonate a user (granted by the user itself) to login as that other user. Audit - recording changes (audit function) - the audit trail

Impersonating the current computer through WindowsIdentity

守給你的承諾、 提交于 2019-12-08 03:31:10
问题 I am trying to get the WindowsIdentity for the computer account the current user is logged into. Currently I am using the following code to get the group membership of the current user: WindowsIdentity currentIdent = WindowsIdentity.GetCurrent(); foreach (IdentityReference indentity in currentGroups) { String groupName = indentity.Translate(typeof(NTAccount)).ToString(); } This works fine, but I also need to do the same for the current computer account preferably without querying AD. I

How to call net.pipe (named pipe) WCF services while impersonating in a Windows Service

半城伤御伤魂 提交于 2019-12-07 19:51:22
问题 I am having an issue calling a WCF service over net.pipe with Windows impersonation from a C# Windows service. Background The service reads from a queue and creates children app domains, each running a particular module per the item pulled from the queue. We call the Windows service a “JobQueueAgent” and each module a “Job”. I will use these terms going forward. A job can be configured to run as a specified user. We use impersonation inside the job’s app domain to accomplish this. The

Job Control with CreateProcessWithLogonW

送分小仙女□ 提交于 2019-12-07 19:51:10
问题 An application I'm writing requires the execution of potentially malicious code to be executed on a host system. The code only interacts with stdin , stdout , and stderr , and should not attempt to interact with the filesystem or network. I've restricted network access through a firewall rule, and filesystem access through running the process as an unprivileged user created through NetUserAdd with CreateProcessWithLogonW . Finally, I assign the process to a job object that limits memory and

C# Directory.exist always return false on the local network

青春壹個敷衍的年華 提交于 2019-12-07 17:20:29
问题 I'm trying to check wether a directory exist on not or a local network. After some research on stackoverflow and MSDN, I develop my code by using impersonate method. The problem is it's not working very well, The Directory.exists() method always return False Here you have my code (it's nearly the same as the one from MSDN): public sealed class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeTokenHandle() : base(true) { } [DllImport("kernel32.dll")] [ReliabilityContract

Multilevel usage of thread impersonation

半世苍凉 提交于 2019-12-07 15:30:51
问题 I'm having some issues with some long-ago written classes that do thread-level impersonation and process spawning. The problem seems to be that my usage of these utility classes is above and beyond what anyone else has tried to do with them. The first does thread-level impersonation by using OpenThreadToken and DuplicateToken along with ImpersonateLoggedOnUser. The second attempts to create a process using CreateProcessAsUser with a token obtained with OpenThreadToken / DuplicateToken. The

FileSystemWatcher running under impersonated user

a 夏天 提交于 2019-12-07 14:34:01
问题 I have an c# winform application that runs under a local account but needs to monitor folders on a domain. I am using slightly modified code from here to copy the files and that works fine. Can similar code be used with the FileSystemWatcher set up impersonation so I can monitor a folder on a domain? 回答1: Yes, there is a good impersonation class here, include this class in your project and than simply place your FileSystemWatcher within a using block like this: using ( new Impersonator(