最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP.Net執(zhí)行cmd命令的實(shí)現(xiàn)代碼

 更新時(shí)間:2011年02月19日 19:16:24   作者:  
ASP.Net執(zhí)行cmd命令的實(shí)現(xiàn)代碼,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Diagnostics;
namespace WebForm
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(ExeCommand("ping www.126.com"));
}
public string ExeCommand(string commandText)
{
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;
try
{
p.Start();
p.StandardInput.WriteLine(commandText);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
}
catch (Exception e)
{
strOutput = e.Message;
}
return strOutput;
}
}
}

相關(guān)文章

最新評(píng)論

怀柔区| 遵化市| 隆安县| 两当县| 芮城县| 宿州市| 安吉县| 花莲县| 和田市| 伊宁县| 个旧市| 秭归县| 临桂县| 阿荣旗| 辰溪县| 平阴县| 称多县| 朝阳县| 大新县| 房山区| 洞头县| 万宁市| 尖扎县| 蒙城县| 伊川县| 松滋市| 察隅县| 柳林县| 淮南市| 綦江县| 新晃| 徐汇区| 莱西市| 土默特左旗| 凯里市| 万山特区| 五指山市| 花垣县| 珠海市| 太和县| 正宁县|