impersonation

Sharepoint: executing stsadm from a timer job + SHAREPOINT\System rights

Hi, I have an unusual situation in which I need a sharepoint timer job to both have local administrator windows privileges and to have SHAREPOINT\System sharepoint privileges. I can get the windows privileges by simply configuring the timer service to use an account which is a member of local administrators. I understand that this is not...

Impersonation in IIS 7.0

I have a website that works correctly under IIS 6.0: It authenticates users with windows credentials, and then when talking to the service that hits the DB, it passes the credentials. In IIS 7.0, the same config settings do not pass the credentials, and the DB gets hit with NT AUTHORITY\ANONYMOUS. Is there something I'm missing? I've t...

Is it possible to unit test a class that makes P/Invoke calls?

I want to wrap a piece of code that uses the Windows Impersonation API into a neat little helper class, and as usual, I'm looking for a way to go test-first. However, while WindowsIdentity is a managed class, the LogonUser call that is required to actually perform the logging in as another user is an unmanaged function in advapi32.dll. ...

Can I turn off impersonation just in a couple instances.

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 the...

Impersonation in .NET

Is there a simple out of the box way to impersonate a user in .NET? So far i have been using this class from code project for all my impersonation requirements. But is there a better way to do it,by using .NET framework, out of the box? I have a user credential set, (username, password, domain name) which represents the identity i need t...

Is it possible to impersonate a user without logging him on?

Hello all, Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user. Thanks in advance. ...

Calling WMPLib.mediaCollection methods from ASP.NET on IIS return empty lists

I am trying to access a Windows Media Player library from ASP.NET. The following code: WMPLib.WindowsMediaPlayer mplayer = new WMPLib.WindowsMediaPlayer(); WMPLib.IWMPStringCollection list = mplayer.mediaCollection.getAttributeStringCollection("artist", "audio"); Returns an non-empty list when run using the VS2005 development web ser...

Reading hidden share in C#

So I have a small C# app that needs to periodically check the contents of directories on multiple machines on the network. I thought I could just read \hostname\C$ as a directory path, but with the normal Directory class there doesn't seem to be a way to authenticate against the other servers so you can access the hidden share. I'm sure...

How do I move files from one machine to another using ASP.NET?

Let's say that I have a site where once the user selects a few options, the following (should) happen: Grabs files (in a directory) off of the local machine - works fine so far Moves them to a remote server - this is where I need help Details: The remote server will be found via UNC path (\servername\xyz) I have access to the usern...

Exchange Web Services, try to use ExchangeImpersonationType ...

I am trying to use EWS, first time trying to use the ExchangeServiceBinding. The code I am using is below: _service = new ExchangeServiceBinding(); //_service.Credentials = new NetworkCredential(userName, userPassword, this.Domain); _service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; _service.Url = this.ServiceU...

Impersonation MFC C++

Hi, I want to impersonate other user in windows, for example: I create a directory with permission only for user A and for the administrators, when logon with user B and run .exe I want to impersonate user A to have permission to edit/remove/insert in that specific directory. How can I do it? I found this: http://msdn.microsoft.com/en...

Need to Impersonate user forAccessing Network resource, Asp.Net Account

Hi, I need to access a network resource on which only a given Domain Account has access. I am using the LogonUser call, but get a "User does not have required priviliege" exception, as the web application is running with the asp.net account and it does not have adequate permissions to make this call. Is there a way to get around it? Ch...

ASP.NET aspx page code runs impersonated though impersonation is disabled

I have a blank test app created in VS 2005 as ASP.NET application. MSDN says that By default, ASP.NET does not use impersonation, and your code runs using the ASP.NET application's process identity. And I have the following web.config <configuration> <appSettings/> <connectionStrings/> <system.web> <!-- ...

ASP.NET: Impersonate against a domain on VMWare

I need to impersonate myself as a domain user in a ASP.NET application running on VMWare machine. Since the VMWare machine is not itself in the domain, ASP.NET is unable to resolve the user token (specified in web.config). Is there a way to do that? Thanks in advance, Petr ...

C#: Load roaming profile and execute program as user

In an application I need to execute other programs with another user's credentials. Currently I use System.Diagnostics.Process.Start to execute the program: public static Process Start( string fileName, string arguments, string userName, SecureString password, string domain ) However this function does not load the roam...

System.Diagnostics: How to log using an identity

I have implemented tracing based on System.Diagnostics. I am also using a System.Diagnostics.TextWriterTraceListener, and hooked the whole trace up to a MOSS 2007 Web Application. The trace for some reason is trying to (a) create the log file, and/or (b) write to the log file using the user that is currently browsing the SharePoint s...

can log4net be configured to run under its own identity?

I'm thinking about using log4net in a MOSS(SharePoint) 2007 project, but I need to know if the logging can easily be configured to log using a certain username + password. ...

ASP.NET Impersonation and SQL Server Trusted Connection Calls

I am working on an ASP.NET page that we, in code impersonate the requesting user. We are using the following code to start impersonating. Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity currentWindowsIdentity = CType(User.Identity,...

Impersonate another user in Visual SourceSafe

We had an employee leave the company, and they left some files checked out in our VSS database. What is the best way to impersonate that user, so I can release those files? ...

asp.net impersonation

I am writing a web application that works with exchange, and so needs to impersonate an account that has admin rihgts to Exchange. This account is specified by the user on setup. What is the best way to get impersonation to use this account, obviously hard-coding this into the web.config won't work as it needs to be able to change, but ...