asp.net code to shutdown, restart, hibernate,sleep, and logoff system
Thanks
Restart
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rishikesh Kumar SinghRank #1,250 · 1.4K reputationPosted Feb 21, 2013, 11:35 PM EST
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 NayakRank #47 · 31.5K reputationPosted Feb 21, 2013, 10:51 PM EST