Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
we can show a form like this:


C#
private void btnBill_Click(object sender, EventArgs e)
{
        bill_f billform = new bill_f();
        billform.Show();
}


I want to run "billform.Show()" as Administrator ,with out running main form as administrator
Posted
Updated 30-Jul-13 20:56pm
v3
Comments
[no name] 31-Jul-13 2:26am    
what you are trying to achieve...??

hope understood the thing correctly

check the link: setting-authorization-rules-for-a-particular-page-or-folder-in-web-config.aspx[^]
 
Share this answer
 
Comments
satheeshk787 31-Jul-13 2:37am    
Not in ASP.NET
[no name] 31-Jul-13 2:40am    
then in what..?? you should mentioned in tag..
You can look at adding <requestedexecutionlevel level="requireAdministrator" uiaccess="false" /> to the application manifest file.
This will force the user to run as administrator.
 
Share this answer
 
 
Share this answer
 
v2
Comments
Sushil Mate 31-Jul-13 2:56am    
I don't understand how is this possible, my main thread is not running under administrator privilege but I can run his child thread with administrator privilege? please elaborate if you have any information about this?
Maciej Los 31-Jul-13 2:59am    
Please, follow the links ;)
I believe what you are trying to achieve is not possible!
If I understand correctly, you wish to elevate the currently running process to perform some tasks by the new dialog that requires Administrator privileges.

You can see that various programs that utilize UAC actually launch a separate process each time an administrative action needs to be performed like TaskManager.

If you wish to elevate a process you are starting, you can use the StartInfo.Verb = "runas":
C#
...
startInfo.Verb = "runas";
System.Diagnostics.Process.Start (startInfo);


You could however perform operations on behalf of a different user, using Impersonation
See A small C# Class for impersonating a User[^]

Good luck,
Edo
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900