asp.net code to shutdown, restart, hibernate,sleep, and logoff system
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rishikesh Kumar SinghPosted Feb 22, 2013, 4:35 AM
Step-1: Add a namespace
using System.Diagnostics;
Step-2: Write few lines of code on button click:
private void button1_Click(object sender, EventArgs e)
{
ProcessStartInfo startinfo = new ProcessStartInfo("shutdown.exe", "-s");
Process.Start(startinfo);
}
Note:- use -r in place of -s to restart...
Go through this
http://www.c-sharpcorner.com/UploadFile/0f68f2/shutdown-and-restart-system-through-C-Sharp-code/
http://www.codeproject.com/Tips/480049/Shut-Down-Restart-Log-off-or-Lock-your-computer-in
Please mark it as an accepted answer if it helps you...otherwise let me know i will send you the complete code..
Satyapriya NayakPosted Feb 22, 2013, 3:51 AM