最新国产好看的视频,伊人天堂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)論

廊坊市| 田东县| 久治县| 湛江市| 广州市| 琼结县| 金华市| 石景山区| 平定县| 乐山市| 额尔古纳市| 荆门市| 北京市| 商水县| 琼结县| 米脂县| 扬中市| 察雅县| 朔州市| 松溪县| 黄石市| 凤冈县| 香格里拉县| 长乐市| 游戏| 宁夏| 阿合奇县| 江川县| 化德县| 旺苍县| 湖南省| 克山县| 苏尼特右旗| 望奎县| 雷州市| 榆社县| 宁明县| 葵青区| 灵川县| 青冈县| 仙居县|