impersonation

Permission issue when webservice deployed as virtual directory.Works in VS IDE

I have an ASP.NET web service which will create a text file in a path which is being passed as a parameter to the method. private void CreateFile(string path) { string strFileName = path; StreamWriter sw = new StreamWriter(strFileName, true); sw.WriteLine(""); sw.Write("Created at " + DateTime.Now.ToStr...

WCF Fails when using impersonation over 2 machine boundaries (3 machines)

These scenarios work in their pieces. Its when i put it all together that it breaks. I have a WCF service using netTCP that uses impersonation to get the callers ID (role based security will be used at this level) on top of this is a WCF service using basicHTTP with TransportCredientialOnly which also uses impersonation I then have a ...

How to Impersonate a user in managed code?

Given a username and password how do i impersonate that user and run some code as that user. And by managed i mean without pinvokes or dllimports ...

Add ASP.NET web service while impersonating credentials.

I have a web reference that I do not have access to through my windows credentials, but do through impersonation. Unfortunately, I cannot update or add the reference because of my lack of credentials. When the service is added, it works fine when I set impersonation to true and add credentials. Is there a way to impersonate a creden...

User privileges required for System.DirectoryServices

I'm using System.DirectoryServices to list the status of websites running on a server. Currently I'm using impersonation of an admin account for this to run but I'd prefer to have a specific user account with the bare minimum privileges. Can anyone point me in the right direction? ...

ASP.NET Anonymous user cannot print to a network printer

Hi, I have an ASP.NET application where user is Anonymous when he connects to website. Also I have a printing server inside network. I want to let this user to print to the network printer. In order to print I have to use File.Copy command. When I do this I get "Access denied". So I tried to impersonate the user with credentials of use...

lsass.exe cousumes a lot of memory and CPU

I've create Impersonation class which are include WindowsIdentity and WindowsImpersonationContext and I've add the Impersonation in my authentication application after the service is running for a while the lsass.exe process is consuming a lot of memory and CPU Could you please advice me how to solve this issue? public class Impersonat...

RW access to shared Windows folder using different user credentials in .NET

We are working in Windows network (AD in use) We have folder shared by user (access limited for this user only) User credentials are known I need to access to that share inside my app. Note I've read about Impersonation but what I can do is open entire application in new user context (but what I need is working as currently logged use...

Integrated Windows authentication in IIS causing ADO.NET failure

We have a .NET 3.5 Web Service (not WCF) running under IIS. It must use identity impersonate="true" and Integrated Windows authentication in order to authenticate to third-party software. In addition, it connects to a SQL Server database using ADO.NET and SQL Server Authentication (specifying a fixed User ID and Password in the connectio...

Redmon's Run As User not loading user's enviroment variables

I'm attempting to use Redmon http://www.winimage.com/misc/redmon/ to send print jobs to a custom C# application. Redmon "runs" (actually the Print Spooler) as SYSTEM but has an option to Run As User to allow your application to run under the user that printed the job. The problem is that it doesn't appear to load the user's environment. ...

Impersonation in asp.net, confused about implmentation when used with Active Directory & Sql Server

I have an internal website that is using integrated windows authentication and this website uses sql server & active directory queries via the System.Directory.Services namespace. To use the System.Directory.Services namespace in ASP.NET I have to run IIS under an account that has the correct privileges and importantly have impersonatio...

how to use hashed password in impersonate of ASP.NET

I have an ASP.NET application that requires impersonation as an administrator user. In web.config: <identity impersonate="true" userName="administrator" password="password"/> The customer complained about saving the password in clear text format. Is there a way to save the password here as hashed? ...

WCF Web Services - Multiple Hop impersonation on the same server

Hi Folks I have 3 web services, all located on the same server. My Client calls Service A, which impersonates the client to call Service B, and all is well. Now, I want to impersonate the caller of service B (which is my username) to call Service C. When I use the same technique as before (AllowedImpersonationLevel = Impersonate, u...

LogonUser using LOGON32_LOGON_NEW_CREDENTIALS works against remote untrusted domain machine

So between the two machines, there is no trust - they are in different domains. I've successfully connected to the remote machine using LogonUser API using logon type, *LOGON32_LOGON_NEW_CREDENTIALS*. I am able to retrieve the content of a directory using the UNC share, and create a file stream to "download" the file. So far so good. ...

Passing windows credentials through web application, to WCF

I've checked other questions, but I can't find a working answer I have a .Net web application which successfully takes on the callers windows credentials (Thread.CurrentPrincipal is my windows user). Within that app, I call to a WCF service, but my windows identity isn't passed up. Regardless of what I put in the binding: NetTcpBindi...

any help on impersonation

Hi I have a web application running on the hosting server. I want to used the code below to perform impersonation, but I am confused where do I get the user,domain and password to supply of the said parameters of LogonUser function. Is this our server account in the hosting server or is this coming from custom identity(form authenticati...

Accessing a drive on remote server via app.config

I am working on a website with a scheduled dataloader exe. The website lives on the web server and the dataloader lives on the DB server. One of the steps in the process is for the dataloader to access the WEB server (to copy/paste a maintenance page file..e.g.\192.168.1.101\c$\maintenance.htm). I am, not surprisingly, running into ...

Asp.Net Impersonation Fails On First Try But Succeeds on Second

We are using RDLC's in a Asp.net web application. For reasons beyond our understanding, the first call to the database server fails with the following error: An error has occurred during report processing. Cannot open database "TryParkingIt2" requested by the login. The login failed. Login failed for user 'EXTRANET\OurServerNameHer...

Can the LocalSystem account impersonate any user ? Even if the user is not logged on ?

Hi, I have a Windows service running as LocalSystem that needs to access some network resources. I found a way to impersonate a user that is currently logged on, by retrieving the token with OpenProcessToken, duplicating it and calling WindowsIdentity.Impersonate. That way I can access the same network resources as the impersonated user...

IIS 7.5, ASP.NET, impersonation, and access to C:\Windows\Temp

Summary: One of our web applications requires write access to C:\Windows\Temp. However, no matter how much I weaken the NTFS permission, procmon shows ACCESS DENIED. Background (which might or might not be relevant for the problem): We are using OLEDB to access an MS Access database (which is located outside of C:\Windows\Temp). Unfortu...