473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

run applications as impersonated user?

Hi,

I checked the sample application found on MSDN :

http://msdn.microsoft.com/library/de...nateTopic1.asp

I logged on as a normal user, i impersonated the administrator account,
tried to run Shutdown.exe, it gives me access denied. Can someone tell me
why?

here's the code:
Console.WriteLine("After impersonation: "
+ WindowsIdentity.GetCurrent().Name);

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"C:\WINDOWS\system32\shutdown.exe";
p.StartInfo.Arguments = "/s";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();
Console.WriteLine(output);

// Stop impersonating the user.
impersonatedUser.Undo();

// Check the identity.
Console.WriteLine("After Undo: " +
WindowsIdentity.GetCurrent().Name);

thanks a lot
mustafa
Nov 16 '05 #1
0 1117

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ray | last post by:
DB2 V7.2 Is it possible to list applications connected to a node by Auth ID? Is it possible to force applications connected to a node by Auth ID or am I forced to use App. Handle? Thanks, Ray
5
by: Markus Stehle | last post by:
Hi all! I have asp.net web application that uses static impersonation. Is it possible to change the impersonated user during runtime? Within some parts of my application I would like to...
0
by: Adrian Bezzina | last post by:
Hi, Does anyone know how to start a new thread in ASP.NET with the ASP.NET impersonated user as i am getting permission errors when try to access the file system, and when I don't use threading,...
1
by: Chris Simmons | last post by:
I have an application where I am using impersonation. My development workstation is XP. For development, things went smoothly. However when deploying to the server, which is Windows Server 2003,...
3
by: stueyh | last post by:
When attempting to connect to an Access 2000 DB using ADO.Net from within ASP.Net running under an impersonated local user account receiving the following error. ERROR Disk or network error....
2
by: Grant Holdom | last post by:
Hi, We are trying to kick off an executable from an asp.net page. We have followed article 889251 "How to spawn a process that runs under the context of the impersonated user in Microsoft...
2
by: Patrick | last post by:
I have an ASP.NET web service whose Web.Config is set to use impersonation <authentication mode="Windows" /> <identity impersonate="true" /> Within a Web Method, I want to use...
12
by: Simon Hart | last post by:
Hi, I am using Impersonation and turned off anon access for my web service. I am using the administator to authenticate the request using ICredentials. I am simply trying to read a key in...
4
by: Rik Hemsley | last post by:
Hi, Our web application impersonates a domain user when it runs. Usually, the printers visible to the application are the same as those visible to the domain user. At one installation, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.