How to ShutDown your PC using Asp.Net


Description:-

This Article will show you that how to shut down the computer using asp.net C#. here i have create demo example to shutdown computer using dot net. also if you want to stop the shut down process then also you can by typing below command in command prompt. 

also you can set time or restart by typing command like. if you want to restart then you have to insert command.

shutdown -r

if you want to set particular time for shutdown then you have to set time in command like.

shutdown -s -t 06

Default.aspx.cs:-

Add a namespace

using System.Diagnostics;

Write few lines of code on button click:

protected void Button1_Click(object sender, EventArgs e)
{
    ProcessStartInfo startinfo = new ProcessStartInfo("shutdown.exe", "-s");
    Process.Start(startinfo);
}

Note:- if you want to Cancel Shutdown then you can open you Command Prompt and Type.
'Shutdown -a' you’re Shutdown Process will be Cancel.

Related Posts

Previous
Next Post »

1 comments:

comments

Thanks for comments.....