How to shutdown machine from ASP.NET

岁酱吖の 提交于 2019-12-05 11:54:59

Have you tried to run a simple batch file instead of starting up the shutdown process in ASP.NET ? The whole process is described here: remote shutdown/restart using ASP.NET

Old question, but I wanted to do this myself, and just figured out the answer. So try this:

Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "shutdown";
startInfo.Arguments = "/s /t 5";
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
process.StartInfo = startInfo;
process.Start();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!