impersonation

Can I build a .net web service that allows anonymous access but impersonates user privilages based on userid?

I have a web application on an IBM WAS server (Windows). In the WAS app users are able to browse files on a different server. This functionality connects to a web service in order to retrieve a listing of files from a network path. The web service is built with .net and resides on a separate server which is in the same domain as the f...

impersonation of active directory user in vb.net

hi, i've never programmed the active directory but i would like to do the following: on the asp.net site, login using a valid active directory username and password. if the login is valid, redirect to a page to do some actions. in a related task, but not part of part 1, unlock an account or change the password of an active directory a...

C# - Get ASPNET WindowsIdentity

Hello, I'd like to give the ASPNET user Full Control over several files, but it looks like I'll need to get the account's token first. Does anyone know how to impersonate the ASPNET account within a desktop app? Thanks! ...

How can I impersonate a different user while opening a virtual directory?

We have an ASP.NET (3.5) application which uses Forms Authentication to authenticate accounts. On the logon form, I also get a windows login token using LogonUser, which I use to impersonate the logged on user for browsing private directories (the files are displayed in a GridView, and the user is impersonated just before the data is bo...

how to impersonate a windows domain user for automated web testing?

we are about to build several UI test with selenium-rc and the java client the app itself is a classic asp web application that uses integrated security to retrieve the user's permissions from a database, and then, according to those permissions, displays a menu with the appropiate options. we'd like to automate that test, something li...

WindowsIdentity winId = (WindowsIdentity)HttpContext.Current.User.Identity; How to make this cast work; currently it is failing

I am basically trying to access the network share resources from my Web Application by impersonating the logged in user. I followed this example [http://msdn.microsoft.com/en-us/library/ms998351.aspx#paght000023_impersonatingbyusingwindowsidentity], here the writer does not mention about the cast failing. When i did that cast, I got th...

Does Impersonation work in ASP.NET MVC

I am having issues with Impersonation in an ASP.NET MVC application, and just want to check if there are any known issues. Thanks. ...

LogonUser works only for my domain

I need to impersonate a user using C#. I use the LogonUser Win32 API. This works fine when impersonating users from the same domain as the currently logged-in user. However I get "false" as response when I try to impersonate users from other domains. What can cause this? ...

LogonUser and delegation

I'm using the LogonUser win32 api: token = LogonUser(...) WindowsIdentity newId = new WindowsIdentity(token); WindowsImpersonationContext impersonatedUser = newId.Impersonate(); However when calling a WCF service after this I'm not able to use the impersonated identity. I think this is because impersonatedUser.Impersonatio...

Can I impersonate a user on a different Active Directory domain in .NET?

I have two Active Directory domains, A and B. Users in domain A need to run an application on their desktops to view and manipulate a resource located on a server in domain B. Each user also has an account in domain B. Is it possible to impersonate each user's domain B identity to perform operations on the domain B resource programati...

Can you perform an impersonated search in SharePoint without providing a password?

I have done impersonation in SharePoint quite a bit in the past by doing something such as the following. SPWeb web = SPContext.Current.Web; string currentWebUrl = web.Url; SPUser user = web.EnsureUser(loginToImpersonate); using (SPSite site = new SPSite(currentWebUrl, user.UserToken) { using (SPWeb impersonatedWeb = site.OpenWeb())...

Using advapi32.dll:LogonUserA() to impersonate a remote machine's local user

I need to be able to run RegLoadKey() on a remote machine, and it may be that my machine and the remote machine are not in the same domain. If they are, the below code works OK and I can impersonate a user that has admin privileges on the machine. Otherwise, if we're talking about local users, according to this discussion I found... htt...

Is an LSA MSV1_0 subauthentication package needed for some impersonation use cases?

Greetings, I'm working with a vendor who has implemented some code that uses a Windows LSA MSV1_0 subauthentication package (MSDN info if you're interested: http://msdn.microsoft.com/en-us/library/aa374786(VS.85).aspx ) and I'm trying to figure out if it's necessary. As far as I can tell, the subauthentication routine and filter allow ...

Impersonating an Assembly

I have 2 compiled assemblies. Assembly A references assembly B. I would like to change some code in assembly B. I would like to create a class library that impersonates assembly B in the eyes of assembly A. I want assembly A to continue working with my new types and namesspaces as if nothing ever happened. Can I just create the new ass...

Impersonate using Forms Authentication

I have an ASP.NET site that must use Forms Authentication and not Windows Authentication to access a ActiveDirectoryMembershipProvider. The site must use forms because they need a designed input form instead of the browser authentication popup that Windows authentication uses. The site needs to impersonate the user logged in via Active...

how to impersonate client side of wcf call

Hi, I need some help about WCF and authorization. Currently I have a client which calls as .NET remoting object hosted in a windows service and which is calling a WCF service (with wshttpbinding). The WCF service is using windows authentication with message based security. The windows service is running with a special account. Once a c...

defaultRedirect page contents are not displayed

An ASP.Net 2.0 project uses Impersonation. If Web.config's username/password are not configured or are expired, I'd like to display a generic error page (even for local users). <authentication mode="Windows" /> <identity impersonate="true" userName="username" password="password"/> <customErrors mode="On" defaultRedirect="myErrorPage.htm...

Alternatives to LogonUser for network impersonation (C++)

Are there any alternatives to LogonUser and for impersonating given account in order to access network resources? I'm looking for the method of impersonation which would let me connect to machine in foreign domains (or, workgroup machines for the same matter). For initial data I have: machine name, username (or domain\username), cleart...

.Net classes to control services on a remote machine?

Hi all, Yes I could google this but I'm being a little lazy. I need to remotely control windows services on another machine. Does the ServiceController class let me do this? What restrictions are there? Can I start / stop / change the "run as" details remotely, ie change a password that's due to expire? I'll be attempting to give ...

Run Code as a different user (C#)

Is there a way to tell my code to run as a different user? I am calling NetUserSetInfo via a PInvoke and I need to call it as a different user. Is there a way to do that? ...