impersonation

Setting directory security to allow user and deny all

I have winforms app, in which I need to access a secured directory. I'm using impersonation and create WindowsIdentity to access the folder. My problem is writing unit tests to test the directory security; I'd like to a write a code that creates a directory secured to only ONE user, which isn't the current user running the UT (or else ...

Impersonate SYSTEM (or equivalent) from Administrator Account

This question is a follow up and continuation of this question about a Privilege problem I'm dealing with currently. Problem Summary: I'm running a program under a Domain Administrator account that does not have Debug programs (SeDebugPrivilege) privilege, but I need it on the local machine. Klugey Solution: The program can install i...

Impersonating a user in wrong domain doesn't throw exception

I used the common impersonation code and it worked just fine, until I inserted random 'dggdgsdg' in domain - and it worked nonetheless... if (LogonUser(Username, Domain, Password, Logon32LogonInteractive, Logon32ProviderDefault, ref existingTokenHandle) && DuplicateToken(existingTokenHandle, (int)SecurityImpersonationLevel.SecurityD...

Can I use a attribute to make .net impersonate another user?

I am familiar with impersonating an account in .net by using: dim myIdentity as WindowsIdentity = someIdentity using ctx as WindowsImpersonationContext = myIdentity.Impersonate() doStuff() end using Is it possible to define a .net attribute so that I could write something like: < runAsUser(someIdentity) > public sub doStuff...

asp.net impersonation identity: Where does it come from?

Here's a simple question I've been stuck on for a while. When I set < identity impersonate=true > in my web.config so that asp.net impersonates the logged on user automatically (or the anonymous account if not using Windows Authentication), where does the identity that asp.net impersonates come from? This document: http://msdn.microsof...

why does windows authentication / impersonation fail on asp.net application with iis 7.5 / windows 7 /

hi there; i'm troubleshooting why i cannot get past the login dialog on an asp.net site configured for windows authentication and impersonation. help me before i switch to os x development and objective-c i have an asp.net 2.0 application and i'm trying to deploy it on windows 7 with iis 7.5. i've created a new site, and bound it to loc...

BITS, TakeOwnership, and Kerberos / Windows Integrated Authentication

We're using BITS to upload files from machines in our retail locations to our servers. BITS will stop transferring a file if the user who owns the BITS job logs off. Therefore, we're using a Windows Service running as LocalSystem to submit the jobs to BITS and be the job owner. This allows transfers to continue 24/7. However, it raises ...

How do you pass user credentials from one process to another for Impersonation in .NET 1.1?

I have a Windows Service (written in .NET 1.1) running under a specific user account and instances of the service running on several servers. I would like to pass user credentials (username, password, domain) to the service from a WinForms application and have the service read/write files in the server's local file system impersonating...

Solution to avoid double-hop from client > web service > SQL Server

My project invoves a user connecting from client to web service, and then web service to SQL Server. The web services and SQL Server are on separate machines. Because of security requirements, we cannot used mixed mode in SQL Server, only Windows authentication. We are experiencing the "double-hop" issue between web service and SQL Serv...

impersonation in asp.net not working with sql server

I have a very strange problem. I have a httpmodule that is running with impersonation (for an anonymous user) through IIS. Impersonation is not taking effect in some cases but is in others. The module is doing an asynchronous web service call, followed by a database call. All of this takes place in the PreRequestHandler event. I'm findin...

Programmatically change System.Web under location

Hi everyone. I am trying to add a way into our own built cms system a way to programmatically update impersonation rules in the web.config. In essence this is pretty easy and know how to do it, however (hence the question) I am trying to edit an impersonation rule in a system.web section inside a <location /> section <location allowOver...

Cannot write on a mapped drive using impersonation

Basically I'm running the same problem as this post http://stackoverflow.com/questions/2669672/accessing-mapped-drives-when-impersonating-in-asp-net I'm working on a legacy website and I need to allow the admins to change the site's logo, banners, etc, from an image file on their desktops to a mapped drive on the server. So, their webs...

SQL Server elevated permissions with integrated login

I have an application running in IIS which connects to a SQL Server 2008 R2 instance using windows integrated authentication. This application does simple read/write operations in the db using a set of stored procedures. I can restrict the privileges in SQL server quite well for this login/user combination. But for a small subset of the...

programmatically access sharepoint lists using impersonation

Hi, I building a console app that runs under a normal user account to access sharepoint lists programmatically. In order to access Sharepoint objects the console application impersonates the user under the context of which the Sharepoint is running. The impersonation is successful but when I try to access any share point SPWeb objects th...

An error occurred loading a configuration file: Failed to start monitoring changes to '\\share'

I had this same problem last week, which resolved itself after I enabled impersonation. Now, I've moved this box to a different location and am now receiving it again. However, this time it is much less descriptive. The only error I'm receiving is: An error occurred loading a configuration file: Failed to start monitoring changes to '\\...

Should I use Thread.BeginThreadAffinity() when using impersonation?

I understand that impersonation is tied to a single thread. However, managed threads could be shuffled around on top of native Win32 threads, so should I try to bind the identity using Thread.BeginThreadAffinity()? And should I use Thread::ManagedThreadId when checking calls later on an object that manages the impersonation? EDIT: But ...

Temporarily removing impersonation

I'm using the following code to impersonate a different user. http://www.codeproject.com/KB/cs/zetaimpersonator.aspx The problem is that I also need to call a local executable. When attempting to access the .exe I'm getting the error "Access Denied". I've tried adding the impersonated user to the file permissions but that didn't appea...

UNIX equivalent of CreateProcessWithLogonW

What I have: the login/password for a UNIX user (alice). Who I am: some other UNIX user (bob). What I need to do: start a process programmatically (foo) as the other user (alice). What the end result should be: the process is running and displays alice as the owner if a "ps" is done. For purposes of privileges, acts as if alice starte...

Asp.net application pool and sql server data connection

I have an asp.net application that runs on a custom app pool which runs under a service level account. I have anonymous access turned off in web.config. The web server is part of a domain. The application access a sql server which runs on the same machine. Currently, for all users, I impersonate the service level account to access the D...

Impersonation using WCF

Hi, I am trying to expose via WCF Web services, functions that access SQL server (via Entity Framework) using the user's credentials (this is a client/dba requirement because of audit triggers etc. Gave up trying to convince them not to use user's credentials) I am having trouble getting WCF to implement impersonation. (in fact its bee...